Dxlibrary-dxButton
Jump to navigation
Jump to search
This function allows creation of a Modern DX Library Button, which is a clickable item as part of GUI.
Notice: This is a function exported by Modern DX Library!
Syntax
element dxButton( float x, float y, float width, float height, string text [, element parent = nil, bool rounded = nil )
Required Arguments
- x: A float of the 2D x position of the button on a player's screen.
- y: A float of the 2D y position of the button on a player's screen.
- width: A float of the width of the button.
- height: A float of the height of the button.
- text: A string of the text that will be displayed as a label on the button.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- parent: This is the parent that the Modern DX Library button is attached.
- rounded: Whether you want the button to be rounded or not. ( true or false )
Returns
Returns an element of the created button if it was successfully created, false otherwise.
Example
This example creates an edit box alongside an "Output!" button. When the button is clicked, it will output the message in the edit box into the Chat Box.
dxLibrary = exports[ "dxLibrary" ] --create our button button = dxLibrary:dxButton( 276, 80, 100, 40, "Output!" ) --Create an edit box and define it as "editBox". editBox = dxLibrary:dxEdit( 277, 184, 197, 46, "Type your message here!" ) -- and attach our button to the outputEditBox function addEventHandler ( "onClick", editBox, outputEditBox ) --setup our function to output the message to the chatbox function outputEditBox () local text = dxLibrary:dxGetText( editBox ) --get the text from the edit box outputChatBox ( text, 255, 255, 255 ) --output that text end addEventHandler ( "onClick", button, outputEditBox )
See Also
General Functions
- dxGetLibrary
- dxGetScreen
- dxSet
- dxGet
- dxSetText
- dxSetTitle
- dxSetVisible
- dxSetEnabled
- dxSetPosition
- dxGetPosition
- dxSetSize
- dxGetSize
- dxGetRootParent
- dxSetColorBackground
- dxSetColorText
- dxSetColorSelected
- dxSetColorBorder
- dxFont
- dxSetFont
- dxGetText
- dxSetTitle
- dxGetTitle
Window
Button
CheckBox
Edit
GridList
- dxGridList
- dxGridListAddItem
- dxGridListRemoveItem
- dxGridListAddColumn
- dxGridListRemoveColumn
- dxGridListGetItemSelected
- dxGridListSetItemSelected
- dxGridListGetScrollHV
Image
Label
List
- dxList
- dxListAddItem
- dxListRemoveItem
- dxListGetItemSelected
- dxListSetItemSelected
- dxListSetColorFilaItem