UI
The UI object, its operations, examples and notes.
Provides the native user-interface API shared by ZPE and ZPEX. It creates windows, controls, layouts, menus, dialogs, charts, browser views, video views, and other native UI elements through the platform UI bridge.
Creating a window
Create a UI object, create a window, add controls, and then show the window. UI methods return native UI objects that can be configured with their own methods.
$ui = new UI() $window = $ui->window("Example", 480, 320) $button = $window->button("Continue") $button->on(UI::Button::Action.click, () => $window->close()) $window->show()
UI functions
The top-level UI object provides availability and display helpers, including available(), is_dark_mode_enabled(), window(), screen_screenshot(), set_icon(), use_native(), browser(), video(), run(), and stop().
Windows, controls, and layouts
Windows support buttons, labels, images, browser and video controls, text fields, checkboxes, text areas, sliders, progress bars, separators, lists, spreadsheets, toggles, tab containers, charts, turtles, menus, dialogs, and file or directory choosers. Layout helpers include vertical, horizontal, grid, and constraint layouts.
Common control methods include enabled(), set_enabled(), visible(), set_visible(), focus(), set_tooltip(), style(), and set_fill(). Specific controls expose their own value, text, selection, media, chart, or menu operations.
Events and enumerations
Controls accept callbacks through on(). Use the static UI event values to avoid relying on literal strings.
$slider->on(UI::Slider::Action.change, &slider_changed) $button->on(UI::Button::Action.mouseover, &button_hovered)
Object functions
aboutaddadd_itemadd_seriesafter_navigatealertapplicationMenuavailablebefore_navigatebrowserbuttoncapture_screencellchange_colourchartcheckboxcheckedclearclear_seriescloseconfirmconstraintLayoutcontrolsenable_default_key_bindingsenabledenableDefaultKeyBindingsfitfocusframelessfullscreengetInputgridLayouthidehorizontalLayoutimageis_dark_mode_enableditemitemWithShortcutlabellayoutlistViewloopmenuminWidthmovemutenavigateonopenDirectoryDialogopenFileDialogpausepen_downpen_upplayplay_pauseprogressBarreloadremove_itemresizablerunsaveFileDialogscreenshotseekselectselected_indexselected_itemseparatorset_backgroundset_cellset_checkedset_colourset_column_nameset_enabledset_foregroundset_iconset_imageset_itemsset_labelsset_legend_visibleset_sourceset_textset_titleset_tooltipset_valueset_visiblesetFillsettingsshowsliderspreadsheetstopstyletabContainertexttextAreatextFieldtoggleturnturn_leftturn_rightturtleUILayoutUIMenuUITabContaineruse_nativevalueverticalLayoutvideovisiblevolumewindow