Class ImageButton

An image button.

Internally it is an Image with a predefined mouse field.

Class ImageButton

imagebutton:new () Constructor.


Class ImageButton

Represents an image button.
imagebutton:new ()
Constructor.

It is Image under the hood so it has same fields as described in Image:new.

  • quad : ⚠️ The number of quads must be equal to 3. These quads are supposed to display different states of the button: the current quad is set according to the state of the button as follows (see also the mouse property in Block:new):

                 | onExit | onEnter | onPress | onClick |
                 |--------|---------|---------|---------|
    quad.current | 1      | 2       | 3       | 2       |
    
  • onClick : a function. Called whenever the button is clicked.

  • mouse : ⚠️ Don't override this property. If you want a button with a custom mouse better to create it from scratch as a user-defined block.

NOTE : this is not a text button - use the inside (see Block:new) property to place a Label inside a button.

Usage:

    local UI = ui.ImageButton {
        path = '/path/to/button.png',
    
        quad = {
            layout = {
                rows    = 3,
                columns = 1,
            },
        },
    
        -- Make the button display text
        inside = {
            ui.Label {
                text = 'Ok'
            }
        }
    }
generated by LDoc 1.5.0 Last updated 2025-11-16 10:17:18