LuaControlProto

This type represents the prototype for controls, encapsulating all of its fields and methods.

circle-info

This is just a prototype and must be constructed into a LuaControl. You may use self inside any overridden methods to access the underlying LuaControl.

__call๏ปฟ

Constructor

Constructs the control prototype.

Arguments

None

Returns

Type

Description

LuaControlProto

The prototype

Example

local proto = gui.LuaControlProto()

initialData

Field

Type: table<any>

This table contains all the initial values held by this prototype. Is propagated to all controls created with this prototype.


onRender

MethodOverridable

Called every time the control is rendered.

Arguments

Name

Type

Description

contents

The main drawing layer

scrollbar

The secondary drawing layer

mins

The top left corner of the control

maxs

The bottom right corner of the control

Returns

Nothing.

Example


onReset

MethodOverridable

Called every time the control is reset.

Arguments

None.

Returns

Nothing.

Example


onFirstRenderCall

MethodOverridable

Called on the first time the control is rendered.

Arguments

None.

Returns

Nothing.

Example


onMouseDown

MethodOverridable

Called whenever the user clicks a mouse button inside the control.

Arguments

Name

Type

Description

key

The pressed key

Returns

Nothing.

Example


onMouseUp

MethodOverridable

Called whenever the user releases a mouse button inside the control.

Arguments

Name

Type

Description

key

The pressed key

Returns

Nothing.

Example


onMouseMove

MethodOverridable

Called whenever the user moves their mouse inside the control.

Arguments

Name

Type

Description

absolutePosition

The absolute cursor position

delta

The difference between current and last cursor position

relativePosition

The relative cursor position (to control's mins)

Returns

Nothing.

Example


onMouseEnter

MethodOverridable

Called once when the user moves their mouse into the control.

Arguments

None.

Returns

Nothing.

Example


onMouseLeave

MethodOverridable

Called once when the user moves their mouse out the control.

Arguments

None.

Returns

Nothing.

Example


onMouseWheel

MethodOverridable

Called once when the user scrolls inside the control.

Arguments

Name

Type

Description

delta

number

The scroll wheel delta and direction

Returns

Nothing.

Example


onKeyDown

MethodOverridable

Called once when the user presses a key inside this control.

circle-info

Requires LuaControl field isTakingKeys to be set to true.

Arguments

Name

Type

Description

key

number

The pressed key

Returns

Nothing.

Example


onKeyUp

MethodOverridable

Called once when the user releases a key inside this control.

circle-info

Requires LuaControl field isTakingKeys to be set to true.

Arguments

Name

Type

Description

key

number

The pressed key

Returns

Nothing.

Example


onTextInput

MethodOverridable

Called once when the user types text inside this control.

circle-info

Requires LuaControl field isTakingText to be set to true.

Arguments

Name

Type

Description

keys

table<number>

The pressed characters list, in unicode

Returns

Nothing.

Example

Last updated