Class Button

A Frame with a button that can be clicked.

This class can handle three different states: "normal", "pushed" and "disabled". You can provide a different texture for each of these states, and two different fontstrings for "normal" and "disabled".

In addition, you can provide another texture/fontstring for the "highlight" state (when the mouse is over the button region).

Note that there is no fontstring for the "pushed" state: in this case, the "normal" font is rendered with a slight offset that you are free to define.

The button "click" event will be triggered by all registered combinations of mouse button events configured with Button:enable_button_clicks.

Note that a Button has Frame:enable_mouse set to true and Button:enable_button_clicks set to true for "LeftMouseUp" by default.

Events. Hard-coded events available to all Buttons, in addition to those from Frame:

  • OnClick: Triggered when the button is clicked, either when Button:click is called, or just when a mouse button is released or pressed when the cursor is over the button (depending on whether clicks are enabled for the mouse button and mouse button state, see Button:enable_button_clicks). This event provides five arguments to the registered callback: a number identifying the mouse button, a number identifying the mouse button event, a string containing the human-readable name of this button event (e.g., "LeftButtonUp", "RightButtonDown", ...), and the mouse X and Y position.
  • OnEnable: Triggered by Button:enable.
  • OnDisable: Triggered by Button:disable.

Inherits all methods from: Region, Frame.

Child classes: CheckButton.

Methods

button:click()
button:disable()
button:enable()
button:get_button_state()
button:get_disabled_font_object()
button:get_disabled_text_color()
button:get_disabled_texture()
button:get_highlight_font_object()
button:get_highlight_text_color()
button:get_highlight_texture()
button:get_normal_font_object()
button:get_normal_texture()
button:get_pushed_text_offset()
button:get_pushed_texture()
button:get_text()
button:get_text_height()
button:get_text_width()
button:is_enabled()
button:lock_highlight()
button:set_button_state()
button:set_disabled_font_object()
button:set_disabled_text_color()
button:set_disabled_texture()
button:set_enabled()
button:set_highlight_font_object()
button:set_highlight_text_color()
button:set_highlight_texture()
button:set_normal_font_object()
button:set_normal_text_color()
button:set_normal_texture()
button:set_pushed_text_offset()
button:set_pushed_texture()
button:set_text()
button:unlock_highlight()
button:disable_button_clicks()
button:enable_button_clicks()
button:is_button_clicks_enabled()
button:set_button_clicks_enabled()


Methods

button:click()
button:disable()
button:enable()
button:get_button_state()
button:get_disabled_font_object()
button:get_disabled_text_color()
button:get_disabled_texture()
button:get_highlight_font_object()
button:get_highlight_text_color()
button:get_highlight_texture()
button:get_normal_font_object()
button:get_normal_texture()
button:get_pushed_text_offset()
button:get_pushed_texture()
button:get_text()
button:get_text_height()
button:get_text_width()
button:is_enabled()
button:lock_highlight()
button:set_button_state()
button:set_disabled_font_object()
button:set_disabled_text_color()
button:set_disabled_texture()
button:set_enabled()
button:set_highlight_font_object()
button:set_highlight_text_color()
button:set_highlight_texture()
button:set_normal_font_object()
button:set_normal_text_color()
button:set_normal_texture()
button:set_pushed_text_offset()
button:set_pushed_texture()
button:set_text()
button:unlock_highlight()
button:disable_button_clicks()
button:enable_button_clicks()
button:is_button_clicks_enabled()
button:set_button_clicks_enabled()
generated by LDoc 1.5.0 Last updated 2023-10-08 09:07:54