Dgs-dxswitchbutton: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Moved to mouseButtons property)
 
(9 intermediate revisions by 2 users not shown)
Line 8: Line 8:


==Properties==
==Properties==
===clickType===
This property determines which button on mouse can change the state of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"clickType",clickType)</syntaxhighlight>
*'''clickType:''' An integer, available values are as follows:
**'''1:''' Left Mouse Button
**'''2:''' Wheel
**'''3:''' Right Mouse Button
===clip===
===clip===
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
Whether the clip property is enabled or not. ''Learn More [[dxDrawText]]''
Line 30: Line 22:
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorWidth",cursorWidth)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorWidth",cursorWidth)</syntaxhighlight>
*'''cursorWidth:''' A float of the cursor width of switch button.
*'''cursorWidth:''' A float of the cursor width of switch button.
===cursorLength===
This property determines the cursor length of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorLength",cursorLength)</syntaxhighlight>
*'''cursorLength:''' A float of the cursor length of switch button.


===colorcoded===
===colorcoded===
Line 35: Line 32:
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"colorcoded",colorcoded)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"colorcoded",colorcoded)</syntaxhighlight>
*'''colorcoded:''' Set to true to enable embedded #FFFFFF color codes.
*'''colorcoded:''' Set to true to enable embedded #FFFFFF color codes.
===colorOn===
The color which can be translated by [[tocolor]] of the background color when the switch button turns on.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"colorOn",{normalColor,hoverColor,clickColor})</syntaxhighlight>
*'''normalColor:''' A integer of background color of turned on switch button.
*'''hoverColor:''' A integer of background color of turned on switch button when the mouse is hovering on it.
*'''clickColor:''' A integer of background color of turned on switch button when the mouse is clicked on it.
===colorOff===
The color which can be translated by [[tocolor]] of the background color when the switch button turns off.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"colorOff",{normalColor,hoverColor,clickColor})</syntaxhighlight>
*'''normalColor:''' A integer of background color of turned off switch button.
*'''hoverColor:''' A integer of background color of turned off switch button when the mouse is hovering on it.
*'''clickColor:''' A integer of background color of turned off switch button when the mouse is clicked on it.
===cursorColor===
The color which can be translated by [[tocolor]] of the cursor color.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorColor",{normalColor,hoverColor,clickColor})</syntaxhighlight>
*'''normalColor:''' A integer of cursor color of the switch button.
*'''hoverColor:''' A integer of cursor color of the switch button when the mouse is hovering on it.
*'''clickColor:''' A integer of cursor color of the switch button when the mouse is clicked on it.
===cursorImage===
The cursor image of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"cursorImage",{normalColor,hoverColor,clickColor})</syntaxhighlight>
*'''normalImage:''' A material of cursor image of the switch button.
*'''hoverImage:''' A material of cursor image of the switch button when the mouse is hovering on it.
*'''clickImage:''' A material of cursor image of the switch button when the mouse is clicked on it.


===font===
===font===
Line 40: Line 65:
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"font",font)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"font",font)</syntaxhighlight>
*'''font:''' A string or a [[Element/DX_font|dx font element]] of the text font of the switch button.
*'''font:''' A string or a [[Element/DX_font|dx font element]] of the text font of the switch button.
===imageOn===
The background image of switch button when the state is on.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOn",{normalImage,hoverImage,clickImage})</syntaxhighlight>
*'''normalImage:''' A material of background image of turned on switch button.
*'''hoverImage:''' A material of background image of turned on switch button when the mouse is hovering on it.
*'''clickImage:''' A material of background image of turned on switch button when the mouse is clicked on it.
===imageOff===
The background image of switch button when the state is off.(
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"imageOff",{normalImage,hoverImage,clickImage})</syntaxhighlight>
*'''normalImage:''' A material of background image of turned off switch button.
*'''hoverImage:''' A material of background image of turned off switch button when the mouse is hovering on it.
*'''clickImage:''' A material of background image of turned off switch button when the mouse is clicked on it.


===shadow===
===shadow===
Line 60: Line 99:
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"stateAnim",stateAnim)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"stateAnim",stateAnim)</syntaxhighlight>
*'''stateAnim:''' A float of the cursor animation progress.
*'''stateAnim:''' A float of the cursor animation progress.
===style===
This property determines the state of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"style",style)</syntaxhighlight>
*'''style:''' Mixed, available values are as follows:
**'''false:''' Default, a switch button with fading color when changing state.
**'''1:''' Split background color for turned on and off ( also split images ).
**'''2:''' Split background color for turned on and off ( not split images ).
**'''3:''' Do not split background color. Just switch gradually.
**'''4:''' No cursor. Just switch gradually.


===textOn===
===textOn===
This property stores the text to be shown when the switch button turns on.(State=true)
This property stores the text to be shown when the switch button turns on.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textOn",textOn)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textOn",textOn)</syntaxhighlight>
*'''textOn:''' A string of the text of the switch button.
*'''textOn:''' A string of the text of the switch button.


===textOff===
===textOff===
This property stores the text to be shown when the switch button turns off.(State=false)
This property stores the text to be shown when the switch button turns off.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textOff",textOff)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textOff",textOff)</syntaxhighlight>
*'''textOff:''' A string of the text of the switch button.
*'''textOff:''' A string of the text of the switch button.


===textColor_t===
===textColorOn===
The color which can be translated by [[tocolor]] of the text when the switch button turns on.(State=true)
The color which can be translated by [[tocolor]] of the text when the switch button turns on.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textColor_t",textColor_t)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textColor_t",textColor_t)</syntaxhighlight>
*'''textColor_t:''' An integer of the color of the text when the switch button turns on.(State=true)
*'''textColor_t:''' An integer of the color of the text when the switch button turns on.


===textColor_f===
===textColorOff===
The color which can be translated by [[tocolor]] of the text when the switch button turns off.(State=false)
The color which can be translated by [[tocolor]] of the text when the switch button turns off.(State=false)
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textColor_f",textColor_f)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"textColor_f",textColor_f)</syntaxhighlight>
*'''textColor_f:''' An integer of the color of the text when the switch button turns off.(State=false)
*'''textColor_f:''' An integer of the color of the text when the switch button turns off.


===textSize===
===textSize===
Line 87: Line 136:
*'''scaleY:''' A float of the 2D Y scale of the text of the switch button.
*'''scaleY:''' A float of the 2D Y scale of the text of the switch button.


===wordbreak===
===troughWidth===
This property determines trough length of switch button.
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"troughWidth",troughWidth)</syntaxhighlight>
*'''troughWidth:''' A float of the trough length of switch button.
 
===wordBreak===
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
Whether the word-break is enabled or not. ''Learn More [[dxDrawText]]''
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"wordbreak",wordbreak)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(switchButton,"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}}

Latest revision as of 14:11, 11 June 2023

DGS Properties is always used to change the gui style and make it more fantastic.

This page shows the properties of dgs-dxswitchbutton that you could use.

Main Functions

Properties

clip

Whether the clip property is enabled or not. Learn More dxDrawText

dgsSetProperty(switchButton,"clip",clip)
  • clip: If set to true, the parts of the text that don't fit within the bounding box will be cut off.

cursorMoveSpeed

This property determines the cursor moving speed when switch button changes state.

dgsSetProperty(switchButton,"cursorMoveSpeed",cursorMoveSpeed)
  • cursorMoveSpeed: A float of the cursor moving speed when switch button changes state.

cursorWidth

This property determines the cursor width of switch button.

dgsSetProperty(switchButton,"cursorWidth",cursorWidth)
  • cursorWidth: A float of the cursor width of switch button.

cursorLength

This property determines the cursor length of switch button.

dgsSetProperty(switchButton,"cursorLength",cursorLength)
  • cursorLength: A float of the cursor length of switch button.

colorcoded

Whether the color code is enabled or not. Learn More dxDrawText

dgsSetProperty(switchButton,"colorcoded",colorcoded)
  • colorcoded: Set to true to enable embedded #FFFFFF color codes.

colorOn

The color which can be translated by tocolor of the background color when the switch button turns on.

dgsSetProperty(switchButton,"colorOn",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of background color of turned on switch button.
  • hoverColor: A integer of background color of turned on switch button when the mouse is hovering on it.
  • clickColor: A integer of background color of turned on switch button when the mouse is clicked on it.

colorOff

The color which can be translated by tocolor of the background color when the switch button turns off.

dgsSetProperty(switchButton,"colorOff",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of background color of turned off switch button.
  • hoverColor: A integer of background color of turned off switch button when the mouse is hovering on it.
  • clickColor: A integer of background color of turned off switch button when the mouse is clicked on it.

cursorColor

The color which can be translated by tocolor of the cursor color.

dgsSetProperty(switchButton,"cursorColor",{normalColor,hoverColor,clickColor})
  • normalColor: A integer of cursor color of the switch button.
  • hoverColor: A integer of cursor color of the switch button when the mouse is hovering on it.
  • clickColor: A integer of cursor color of the switch button when the mouse is clicked on it.

cursorImage

The cursor image of switch button.

dgsSetProperty(switchButton,"cursorImage",{normalColor,hoverColor,clickColor})
  • normalImage: A material of cursor image of the switch button.
  • hoverImage: A material of cursor image of the switch button when the mouse is hovering on it.
  • clickImage: A material of cursor image of the switch button when the mouse is clicked on it.

font

This is equivalent to dgsSetFont/dgsGetFont. Learn More dxDrawText

dgsSetProperty(switchButton,"font",font)

imageOn

The background image of switch button when the state is on.

dgsSetProperty(switchButton,"imageOn",{normalImage,hoverImage,clickImage})
  • normalImage: A material of background image of turned on switch button.
  • hoverImage: A material of background image of turned on switch button when the mouse is hovering on it.
  • clickImage: A material of background image of turned on switch button when the mouse is clicked on it.

imageOff

The background image of switch button when the state is off.(

dgsSetProperty(switchButton,"imageOff",{normalImage,hoverImage,clickImage})
  • normalImage: A material of background image of turned off switch button.
  • hoverImage: A material of background image of turned off switch button when the mouse is hovering on it.
  • clickImage: A material of background image of turned off switch button when the mouse is clicked on it.

shadow

The shadow text of the switch button.

dgsSetProperty(switchButton,"shadow",{offsetX,offsetY,color,outline})
  • offsetX: A float of the 2D X offset of the shadow text of the switch button.
  • offsetY: A float of the 2D Y offset of the shadow text of the switch button.
  • color: An integer of the color of the shadow text of the switch button.
  • outline: A bool of the outline state of the shadow text.

state

This property indicates the state of switch button.

dgsSetProperty(switchButton,"state",state)
  • state: A bool indicates the state of switch button.
    • true: Turns on
    • false: Turns off

stateAnim

This stores the progress of cursor animation, which is not recommend to modify.

dgsSetProperty(switchButton,"stateAnim",stateAnim)
  • stateAnim: A float of the cursor animation progress.

style

This property determines the state of switch button.

dgsSetProperty(switchButton,"style",style)
  • style: Mixed, available values are as follows:
    • false: Default, a switch button with fading color when changing state.
    • 1: Split background color for turned on and off ( also split images ).
    • 2: Split background color for turned on and off ( not split images ).
    • 3: Do not split background color. Just switch gradually.
    • 4: No cursor. Just switch gradually.

textOn

This property stores the text to be shown when the switch button turns on.

dgsSetProperty(switchButton,"textOn",textOn)
  • textOn: A string of the text of the switch button.

textOff

This property stores the text to be shown when the switch button turns off.

dgsSetProperty(switchButton,"textOff",textOff)
  • textOff: A string of the text of the switch button.

textColorOn

The color which can be translated by tocolor of the text when the switch button turns on.

dgsSetProperty(switchButton,"textColor_t",textColor_t)
  • textColor_t: An integer of the color of the text when the switch button turns on.

textColorOff

The color which can be translated by tocolor of the text when the switch button turns off.(State=false)

dgsSetProperty(switchButton,"textColor_f",textColor_f)
  • textColor_f: An integer of the color of the text when the switch button turns off.

textSize

The scale of the text of the switch button. Learn More dxDrawText

dgsSetProperty(switchButton,"textSize",{scaleX,scaleY})
  • scaleX: A float of the 2D X scale of the text of the switch button.
  • scaleY: A float of the 2D Y scale of the text of the switch button.

troughWidth

This property determines trough length of switch button.

dgsSetProperty(switchButton,"troughWidth",troughWidth)
  • troughWidth: A float of the trough length of switch button.

wordBreak

Whether the word-break is enabled or not. Learn More dxDrawText

dgsSetProperty(switchButton,"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

Extra Properties For DGS Plugins