Button Elements#

Buttons provide an input element that a user can click on to perform an action or click on to toggle state (on/off).

Button elements have a single child element, but layout elements, such as boxes can be used to create complex content.

New buttons can be created with the button() function in the eg-overlay-ui module.

Checkboxes#

Checkboxes are a specialized version of a button that displays a toggle (on or off) state.

Checkboxes can be created with the checkbox() function.

Functions#

eg-overlay-ui.button()#

Creates a new uibutton.

Return type:

uibutton

Version History

Version

Notes

0.3.0

Added

eg-overlay-ui.checkbox(size)#

Creates a new uibutton that is specialized as a checkbox.

Parameters:

size (integer) – The width/height of the checkbox.

Note

A checkbox button can’t have a child element and will send two additional events to event handlers:

  • toggle-on

  • toggle-off

Version History

Version

Notes

0.3.0

Added

Classes#

class eg-overlay-ui.uibutton#

A button has a single child element and can be monitored for mouse events.

child(element)#
Parameters:

element (uielement)

Version History

Version

Notes

0.3.0

Added

addeventhandler(handler[, event1, event2, ...])#
Parameters:
  • handler (function)

  • events (string) – (Optional) Name of events this handler will receive.

Return type:

integer

Version History

Version

Notes

0.3.0

Added

removeevnthandler(handlerid)#
Parameters:

handlerid (integer) – An event handler ID returned from addeventhandler()

Version History

Version

Notes

0.3.0

Added

bghover(color)#

Set the color drawn for the button’s hovered background.

Parameters:

color (integer)

Version History

Version

Notes

0.3.0

Added

bghighlight(color)#

Set the color drawn for the button’s highlighted background.

Parameters:

color (integer)

Version History

Version

Notes

0.3.0

Added

border(color)#

Set the color drawn for the button’s border.

Parameters:

color (integer)

Version History

Version

Notes

0.3.0

Added

borderwidth(pixels)#

Set the border thickness.

Parameters:

pixels (integer)

Version History

Version

Notes

0.3.0

Added

checkstate([value])#

Get or set the state of this button if it is a checkbox.

Parameters:

value (boolean) – (Optional) the new state to set.

Return type:

boolean

Version History

Version

Notes

0.3.0

Added

Note

The following methods are inherited from uielement

x([position])#

Set or get the current position X.

Parameters:

position (integer) – (Optional)

Return type:

integer

Important

It is normally not necessary to manually position an element.

Version History

Version

Notes

0.3.0

Added

y([position])#

Set or get the current position Y.

Parameters:

position (integer) – (Optional)

Return type:

integer

Important

It is normally not necessary to manually position an element.

Version History

Version

Notes

0.3.0

Added

width([value])#

Get or set the element’s width.

Parameters:

width (integer) – (Optional)

Return type:

integer

Important

It is normally not necessary to manually set an element’s size.

Version History

Version

Notes

0.3.0

Added

height([value])#

Get or set the element’s height.

Parameters:

width (integer) – (Optional)

Return type:

integer

Important

It is normally not necessary to manually set an element’s size.

Version History

Version

Notes

0.3.0

Added

bgcolor([color])#

Get or set the element’s background color.

Parameters:

color (integer) – (Optional)

Return type:

integer

Version History

Version

Notes

0.3.0

Added