← All built-ins / ui_on()

ui_on()

ui_on(...$args): int

Parameters

NameTypeDescription
$handleintcontrol/menu-item/window handle
$eventstring"click", "change", "select", "close", …
$callbackclosurecalled when the event fires

Return value

Registers an event handler.

Example

echo "ui_on($btn, "click", fn() => ui_set($lbl, "clicked!"));";
ui_on($btn, "click", fn() => ui_set($lbl, "clicked!"));

This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.

See also

ui_timer()ui_run_main()