Buttons#

Functions#

eg-overlay-ui.button()#

Create a new uibutton.

Return type:

uibutton

Version History

Version

Notes

0.0.1

Added

eg-overlay-ui.checkbox(size)#

Create a new uibutton specialized as a checkbox.

Parameters:

size (integer) – The size of the checkbox. This corresponds to a font height and should generally be 1.2 times the font height of surrounding text.

Return type:

uibutton

Version History

Version

Notes

0.0.1

Added

Classes#

class eg-overlay-ui.uibutton#

A button element. Buttons do not display any content themselves outside of borders and background, instead they have a single child.

This can be a uitext for a simple text button, but can also be a layout container that also has children for more complex buttons.

In addition to the events in UI Events, buttons can send the following:

Event

Description

click-left

The button was clicked with the primary/left mouse button.

click-right

The button was clicked with the secondary/right mouse button.

toggle-on

The button has changed to a toggled/checked state.

toggle-off

The button has changed to a untoggled/unchecked state.

Important

The click-* events are only sent when the corresponding mouse button is both pressed and released while the cursor is over the button. This is a more accurate way of determining if the button was clicked intentionally than monitoring for only up or down events.

set_child(uielement)#

Set the child element of this button.

Parameters:

uielement – A UI element.

Version History

Version

Notes

0.0.1

Added

background_color(color)#

Set the background color of this button.

Parameters:

color (integer) – A new background color in RGBA format.

Version History

Version

Notes

0.0.1

Added

border_color(color)#

Set the border color of this button.

Parameters:

color (integer) – A new border color in RGBA format.

Version History

Version

Notes

0.0.1

Added

border_width(width)#

Set the border width of this button.

Parameters:

width – A new border width in pixels.

Version History

Version

Notes

0.0.1

Added

state([value])#

Get or return the state of this button.

Parameters:

value (boolean) – (Optional)

Return type:

boolean

Version History

Version

Notes

0.1.0

Added

addeventhandler(func)#

Add an event handler for this UI element. See UI Events.

Parameters:

func (function)

Return type:

integer

Returns:

A id that can be used with removeeventhandler()

Version History

Version

Notes

0.1.0

Added

removeeventhandler(id)#

Remove an event handler for this UI element.

Parameters:

id (integer)

Version History

Version

Notes

0.1.0

Added