GUI Objects

GUI objects let Expr scripts create custom dialogs, forms, controls, and visual content. They are host application objects, so they are mainly used in custom UI scripts.

The main pattern is:

  1. Create controls.
  2. Configure them with methods.
  3. Add controls to a container or window.
  4. Keep the window object alive while it is open.
  5. Show the window.
class Demo()
{
    wnd = none();
 
    function close()
    {
        wnd.request_close();
    }
 
    function show()
    {
        wnd = window().title('Example').size(320, 160);
        wnd.add(label().position(10, 10).size(260, 24).text('Hello'));
        wnd.add(textbutton().position(10, 50).size(100, 28).text('Close').on_click(this.close));
        wnd.show();
    }
}
 
demo = Demo();
demo.show();

Object Pages

Constructor Page Description
`window()` window Top-level custom Expr window.
`panel()` panel General-purpose container panel.
`group()` group Titled container group.
`splitpanel()` splitpanel Two-pane split container.
`label()` label Static text label.
`textbutton()` textbutton Push button with text.
`drawablebutton()` drawablebutton Button with an image.
`togglebutton()` togglebutton Checkable button.
`togglegroup()` togglegroup Group of selectable toggle choices.
`textinput()` textinput Single-line text input.
`textedit()` textedit Text editor.
`numinput()` numinput Numeric input field.
`slider()` slider Numeric slider.
`combobox()` combobox Drop-down list.
`listbox()` listbox List selection control.
`progressbar()` progressbar Progress display.
`led()` led Status indicator.
`separator()` separator Horizontal or vertical separator.
`menu()` menu Window menu and returned `menu_item` objects.
`image()` image Image display and drawing control.
`snake()` snake Snake game widget.

Previous: msg_password

Next: window