DgsCreateComboBox: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(update arguments names)
 
(6 intermediate revisions by one other user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element dgsCreateComboBox( float x, float y, float width, float height, bool relative, [ element parent = nil, element itemheight = 20, int textcolor = 0xFF000000, float scalex = 1, float scaley = 1, element defimg = nil, element selimg = nil, element cliimg = nil, int defcolor = 0x0078C8C8, int hovcolor= 0xC8005AFF, int clicolor = 0xC8325AFA] )
element dgsCreateComboBox( float x, float y, float width, float height, string caption, bool relative [, element parent = nil, element itemHeight = 20, int textColor = 0xFF000000, float scaleX = 1, float scaleY = 1, element normalImage = nil, element hoveringImage = nil, element clickedImage = nil, int normalColor = 0x0078C8C8, int hoveringColor = 0xC8005AFF, int clickedColor = 0xC8325AFA] )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===  
===Required Arguments===  
[[Image:Mta-screen_2017-08-11_07-43-55.jpg|frame|Example DGS ComboBox.]]
[[Image:DGS_ComboBox.png|frame|Example DGS ComboBox.]]
*'''x:''' A float of the 2D x position of the DGS combobox on a player's screen.  This is affected by the ''relative'' argument.
*'''x:''' A float of the 2D x position of the DGS combobox on a player's screen.  This is affected by the ''relative'' argument.
*'''y:''' A float of the 2D y position of the DGS combobox on a player's screen. This is affected by the ''relative'' argument.
*'''y:''' A float of the 2D y position of the DGS combobox on a player's screen. This is affected by the ''relative'' argument.
*'''width:''' A float of the width of the DGS combobox. This is affected by the ''relative'' argument.
*'''width:''' A float of the width of the DGS combobox. This is affected by the ''relative'' argument.
*'''height:''' A float of the height of the DGS combobox. This is affected by the ''relative'' argument. Note: height must be enough to fit the drop down menu, else the drop down won't appear.
*'''height:''' A float of the height of the DGS combobox. This is affected by the ''relative'' argument. '''Note: The height of the drop list of DGS combo box stands alone, so when creating combo box, there is no need to consider the height of the drop list'''
*'''caption:''' A string for what the title of your combobox will be. This will be shown if no item is selected.
*'''caption:''' A string for what the title of your combobox will be. This will be shown if no item is selected.
*'''relative:''' This is whether sizes and positioning are relative.  If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.
*'''relative:''' This is whether sizes and positioning are relative.  If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.
===Optional Arguments===
===Optional Arguments===
*'''parent:''' This is the parent that the DGS button is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.
*'''parent:''' This is the parent that the DGS button is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.
*'''itemheight:''' A float of the height of every item.
*'''itemHeight:''' A float of the height of every item.
*'''textcolor:''' A integer of the text color used.
*'''textColor:''' A integer of the text color used.
*'''scalex:''' A float of the 2D x scale of the text of the button.
*'''scaleX:''' A float of the 2D x scale of the text of the button.
*'''scaley:''' A float of the 2D y scale of the text of the button.
*'''scaleY:''' A float of the 2D y scale of the text of the button.
*'''defimg:''' A texture element of the background of the button of the combo box( no mouse enter and no mouse click ).
*'''normalImage:''' A texture element of the background of the button of the combo box( no mouse enter and no mouse click ).
*'''selimg:''' A texture element of the background of the button of the combo box which is selected.
*'''hoveringImage:''' A texture element of the background of the button of the combo box which is selected.
*'''cliimg:''' A texture element of the background of the button of the combo box which is clicked.
*'''clickedImage:''' A texture element of the background of the button of the combo box which is clicked.
*'''defcolor:''' An int of the color of the background of the button of the combo box ( no mouse enter and no mouse click ).
*'''normalColor:''' An int of the color of the background of the button of the combo box ( no mouse enter and no mouse click ).
*'''selcolor:''' An int of the color of the background of the button of the combo box which is selected.
*'''hoveringColor:''' An int of the color of the background of the button of the combo box which is selected.
*'''clicolor:''' An int of the color of the background of the button of the combo box which is clicked.
*'''clickedColor:''' An int of the color of the background of the button of the combo box which is clicked.


==Example==
==Example==
Line 34: Line 35:
DGS = exports.dgs  
DGS = exports.dgs  
addEventHandler("onClientResourceStart", resourceRoot, function()
addEventHandler("onClientResourceStart", resourceRoot, function()
qiw = DGS:dgsCreateComboBox(0.29, 0.30, 0.44, 0.04, true)
qiw = DGS:dgsCreateComboBox(0.29, 0.30, 0.44, 0.04, "test", true)
showCursor(true)  
showCursor(true)  
end)
end)

Latest revision as of 13:53, 16 February 2021

This function allows creation of a DGS ComboBox .

Syntax

element dgsCreateComboBox( float x, float y, float width, float height, string caption, bool relative [, element parent = nil, element itemHeight = 20, int textColor = 0xFF000000, float scaleX = 1, float scaleY = 1, element normalImage = nil, element hoveringImage = nil, element clickedImage = nil, int normalColor = 0x0078C8C8, int hoveringColor = 0xC8005AFF, int clickedColor = 0xC8325AFA] )

Required Arguments

Example DGS ComboBox.
  • x: A float of the 2D x position of the DGS combobox on a player's screen. This is affected by the relative argument.
  • y: A float of the 2D y position of the DGS combobox on a player's screen. This is affected by the relative argument.
  • width: A float of the width of the DGS combobox. This is affected by the relative argument.
  • height: A float of the height of the DGS combobox. This is affected by the relative argument. Note: The height of the drop list of DGS combo box stands alone, so when creating combo box, there is no need to consider the height of the drop list
  • caption: A string for what the title of your combobox will be. This will be shown if no item is selected.
  • relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.

Optional Arguments

  • parent: This is the parent that the DGS button is attached to. If the relative argument is true, sizes and positioning will be made relative to this parent. If the relative argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.
  • itemHeight: A float of the height of every item.
  • textColor: A integer of the text color used.
  • scaleX: A float of the 2D x scale of the text of the button.
  • scaleY: A float of the 2D y scale of the text of the button.
  • normalImage: A texture element of the background of the button of the combo box( no mouse enter and no mouse click ).
  • hoveringImage: A texture element of the background of the button of the combo box which is selected.
  • clickedImage: A texture element of the background of the button of the combo box which is clicked.
  • normalColor: An int of the color of the background of the button of the combo box ( no mouse enter and no mouse click ).
  • hoveringColor: An int of the color of the background of the button of the combo box which is selected.
  • clickedColor: An int of the color of the background of the button of the combo box which is clicked.

Example

This example creates a combo box in the center of the screen.

DGS = exports.dgs 
addEventHandler("onClientResourceStart", resourceRoot, function()
	qiw = DGS:dgsCreateComboBox(0.29, 0.30, 0.44, 0.04, "test", true)
	showCursor(true) 
end)

Example Create by :Ridden

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips