Control
This type represents an abstract GUI control.
id
FieldRead only
Type: int
Control ID.
idString
FieldRead only
Type: string
String representation of control's ID. This may be empty for some controls.
isVisible
FieldRead only
Type: bool
Control's visibility state.
parent
FieldRead only
Type: control?
Parent control. Might be nil on some controls.
type
FieldRead only
Type: ControlType
Control's type.
inactive
Field
Type: bool
If set to true, will mark this control to the inactive state.
inactiveText
Field
Type: string
Tooltip replacement to show when control is inactive.
inactiveColor
Field
Type: Color
Label color override for inactive controls.
tooltip
Field
Type: string
Tooltip text.
pos
Field
Type: Vec2
Relative position of this control
size
Field
Type: Vec2
Total size of this control
sizeToParentW
Field
Type: boolean
Whether or not the width of this control is locked to it's parent container
sizeToParentH
Field
Type: boolean
Whether or not the height of this control is locked to it's parent container
isTakingInput
Field
Type: boolean
May not be available for all controls.
Whether or not this control handles input in any way.
isTakingKeys
Field
Type: boolean
May not be available for all controls.
Whether or not this control is listening to generic key presses.
isTakingText
Field
Type: boolean
May not be available for all controls.
Whether or not this control is listening and handling text input.
margin
Field
Type: rect
The margin/offset to the parent container. Left, top, right and bottom, respectively.
isMouseOnMe
Field
Type: boolean
May not be available for all controls.
Whether or not the user is hovering this control.
aliases
Field
Type: table[string]
Alias list for this control. Used in search box to support different naming (e.g. if a user searches for "Double tap", will find "Rapid fire" instead).
GetPosAbs
Method
Returns this control's position relative to the screen origin (0, 0).
Arguments
None.
Returns
Absolute position of this control.
Example
GetArea
Method
Returns a rectangle containing the area of this control relative to the current container.
Arguments
Name
Type
Description
includeMargin
boolean
Whether or not to include the margin in the area.
Returns
Area of this control in container space.
Example
GetAreaAbs
Method
Returns a rectangle containing the area of this control relative to the screen origin (0, 0).
Arguments
Name
Type
Description
includeMargin
boolean
Whether or not to include the margin in the area.
Returns
Area of this control in screen space.
Example
GetLabel
Method
Returns the label of this control in the menu.
This does not work for label types. Use the text field instead.
Arguments
None.
Returns
Control label, if any.
Example
GetHotkeyState
Method
Returns true if any of the control's hotkeys are active.
Arguments
None.
Returns
bool
true if any hotkey is active.
Example
HasHotkeys
Method
Returns true if this control has any hotkeys.
Arguments
None.
Returns
bool
true if control has hotkeys.
Example
SetDimensions
Method
Overrides the offset and size for this control.
This method does not override sizeToParentW and sizeToParentH.
Arguments
Returns
Nothing.
Example
SetVisible
Method
Changes visibility state for this control.
Calling this method on controls that are located in layouts with large amount of other controls will inevitably cause performance issues due to auto-stacking.
Arguments
val
bool
Visibility state.
Returns
Nothing.
Example
AddCallback
Method
Adds a callback to this control.
Arguments
cbk
function
Callback.
Returns
Nothing.
Example
Cast
Method
Attempts to downcast the control to the correct type.
Due to Lua engine's limitations, it is impossible to automatically downcast variables. Usually there is no need to call this method, unless you found some control that wasn't somehow already cast to the desired type. find() methods automatically perform the cast to the correct type.
Arguments
None.
Returns
<control>
New type, if any.
Example
Reset
Method
Resets control's state. This action is usually required if you change control's value directly by interacting with ValueParam.
You also should call this method on layouts if you add multiple controls into them.
Arguments
None.
Returns
Nothing.
Example
Last updated