Dgs-dxbutton: Difference between revisions
Line 14: | Line 14: | ||
*'''alignY:''' Vertical alignment of the text within the button. Can be "top", "center" or "bottom". | *'''alignY:''' Vertical alignment of the text within the button. Can be "top", "center" or "bottom". | ||
=== | ===clickoffset=== | ||
The offset indicates that how much the text of the button will shift when it is clicked. | |||
<syntaxhighlight lang="lua">dgsSetProperty(button," | <syntaxhighlight lang="lua">dgsSetProperty(button,"clickoffset",{offsetX,offsetY})</syntaxhighlight> | ||
*''' | *'''offsetX''' : A float of the 2D X offset relative to the position of the button. | ||
*''' | *'''offsetY''' : A float of the 2D Y offset relative to the position of the button. | ||
*''' | |||
===clickType=== | |||
This indicates that which button of the mouse can have effect on the button. | |||
<syntaxhighlight lang="lua">dgsSetProperty(button,"clickType",clickType)</syntaxhighlight> | |||
*'''clickType''' : If set to 1, only "Left Mouse Button" can do. If set to 2, only "Right Mouse Button" can do. Otherwise it will be both. | |||
===color=== | ===color=== | ||
Line 27: | Line 31: | ||
*'''hovcolor:''' An integer of the color of the background of the button which is selected. | *'''hovcolor:''' An integer of the color of the background of the button which is selected. | ||
*'''clicolor:''' An integer of the color of the background of the button which is clicked. | *'''clicolor:''' An integer of the color of the background of the button which is clicked. | ||
===colorcoded=== | |||
Whether the color code is enabled or not. ''Learn More [[dxDrawText]]'' | |||
<syntaxhighlight lang="lua">dgsSetProperty(button,"colorcoded",colorcoded)</syntaxhighlight> | |||
*'''colorcoded''' : Set to true to enable embedded #FFFFFF color codes. | |||
===font=== | |||
This is equivalent to [[dgsSetFont]]/[[dgsGetFont]]. ''Learn More [[dxDrawText]]'' | |||
<syntaxhighlight lang="lua">dgsSetProperty(button,"font",font)</syntaxhighlight> | |||
*'''font''' : A [[Element/DX_font|dx font element]] of the text font of the button. | |||
===image=== | |||
Require [texture/shader] that can be used as the background of button. | |||
<syntaxhighlight lang="lua">dgsSetProperty(button,"image",{defimg,hovimg,cliimg})</syntaxhighlight> | |||
*'''defimg:''' A texture/shader element of the background of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this image option ) | |||
*'''hovimg:''' A texture/shader element of the background of the button which is selected. ( You can pass a nil value to disable this image option ) | |||
*'''cliimg:''' A texture/shader element of the background of the button which is clicked. ( You can pass a nil value to disable this image option ) | |||
===text=== | ===text=== | ||
Line 57: | Line 78: | ||
*'''offsetY''' : A float of the 2D Y offset of the shadow text of the button. | *'''offsetY''' : A float of the 2D Y offset of the shadow text of the button. | ||
*'''color''' : An integer of the color of the shadow text of the button. | *'''color''' : An integer of the color of the shadow text of the button. | ||
===wordbreak=== | ===wordbreak=== | ||
Line 77: | Line 83: | ||
<syntaxhighlight lang="lua">dgsSetProperty(button,"wordbreak",wordbreak)</syntaxhighlight> | <syntaxhighlight lang="lua">dgsSetProperty(button,"wordbreak",wordbreak)</syntaxhighlight> | ||
*'''wordbreak''' : If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line. | *'''wordbreak''' : If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line. | ||
==See Also== | ==See Also== | ||
{{DGSPROPERTIES}} | {{DGSPROPERTIES}} |
Revision as of 18:55, 8 January 2020
DGS Properties is always used to change the gui style and make it more fantastic.
This page shows the properties of dgs-dxbutton that you could use.
Main Functions
Properties
alignment
Alignment of the text within the button.
dgsSetProperty(button,"alignment",{alignX,alignY})
- alignX: Horizontal alignment of the text within the button. Can be "left", "center" or "right".
- alignY: Vertical alignment of the text within the button. Can be "top", "center" or "bottom".
clickoffset
The offset indicates that how much the text of the button will shift when it is clicked.
dgsSetProperty(button,"clickoffset",{offsetX,offsetY})
- offsetX : A float of the 2D X offset relative to the position of the button.
- offsetY : A float of the 2D Y offset relative to the position of the button.
clickType
This indicates that which button of the mouse can have effect on the button.
dgsSetProperty(button,"clickType",clickType)
- clickType : If set to 1, only "Left Mouse Button" can do. If set to 2, only "Right Mouse Button" can do. Otherwise it will be both.
color
The color which can be translated by tocolor of the background of the button.
dgsSetProperty(button,"color",{defcolor,hovcolor,clicolor})
- defcolor: An integer of the color of the background of the button ( neither selected nor clicked by mouse ).
- hovcolor: An integer of the color of the background of the button which is selected.
- clicolor: An integer of the color of the background of the button which is clicked.
colorcoded
Whether the color code is enabled or not. Learn More dxDrawText
dgsSetProperty(button,"colorcoded",colorcoded)
- colorcoded : Set to true to enable embedded #FFFFFF color codes.
font
This is equivalent to dgsSetFont/dgsGetFont. Learn More dxDrawText
dgsSetProperty(button,"font",font)
- font : A dx font element of the text font of the button.
image
Require [texture/shader] that can be used as the background of button.
dgsSetProperty(button,"image",{defimg,hovimg,cliimg})
- defimg: A texture/shader element of the background of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this image option )
- hovimg: A texture/shader element of the background of the button which is selected. ( You can pass a nil value to disable this image option )
- cliimg: A texture/shader element of the background of the button which is clicked. ( You can pass a nil value to disable this image option )
text
This is equivalent to dgsSetText/dgsGetText.
dgsSetProperty(button,"text",text)
- text : A string of the text of the button.
textColor
The color which can be translated by tocolor of the text of the button.
dgsSetProperty(button,"textColor",textColor)
- textColor : An integer of the color of the text of the button.
textOffset
The offset of the text on button.
dgsSetProperty(button,"textOffset",{offsetX,offsetY,relative)
- offsetX : A float of the 2D X offset relative to the position of the button, depends on relative.
- offsetY : A float of the 2D Y offset relative to the position of the button, depends on relative.
- relative : A bool of whether the offset is relative or absolute.
textSize
The scale of the text of the button. Learn More dxDrawText
dgsSetProperty(button,"textSize",{scaleX,scaleY})
- 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.
shadow
The shadow text of the button.
dgsSetProperty(button,"shadow",{offsetX,offsetY,color})
- offsetX : A float of the 2D X offset of the shadow text of the button.
- offsetY : A float of the 2D Y offset of the shadow text of the button.
- color : An integer of the color of the shadow text of the button.
wordbreak
Whether the word-break is enabled or not. Learn More dxDrawText
dgsSetProperty(button,"wordbreak",wordbreak)
- wordbreak : If set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.
See Also
General Properties
Unique Properties For DGS Core Elements
- dgs-dx3dinterface
- dgs-dx3dimage
- dgs-dx3dtext
- dgs-dx3dline
- dgs-dxbutton
- dgs-dxcheckbox
- dgs-dxcombobox
- dgs-dxdetectarea
- dgs-dxedit
- dgs-dxgridlist
- dgs-dximage
- dgs-dxlabel
- dgs-dxline
- dgs-dxmemo
- dgs-dxprogressbar
- dgs-dxradiobutton
- dgs-dxscrollbar
- dgs-dxscrollpane
- dgs-dxselector
- dgs-dxswitchbutton
- dgs-dxtabpanel
- dgs-dxtab
- dgs-dxwindow