beetlebug

ztk::ios::Button

Makes a button (UIButton with a configuration of iOS 15) that runs a script at a tap.

Synopsis

ztk::ios::Button new ?OPTION VALUE ...?
$screen add button ?OPTION VALUE ...?

Arguments

Name Type Default Meaning
-text text empty The title.
-style filled, tinted, gray, plain, bordered filled The look of the button.
-enabled boolean 1 0 dims the button, and it ignores taps.
-command script empty Runs at the global level at a tap, with the button appended.
invoke method Runs the action, as a tap does.
-hidden, -accessibilityLabel, -accessibilityHint option As for each view (ztk::ios).
configure, cget, destroy method As for each object (ztk::ios).

Return value

new gives the object. invoke gives an empty string.

Errors

Error When
bad style "X": must be bordered, filled, gray, plain, or tinted -style has another value.
expected boolean value but got "X" -enabled is no boolean.
unknown option "-X": must be ... Another option.

Platforms

Platform Works
Windows No
macOS No
Linux, Wayland No
Linux, X11 No
Web No
iOS Yes
Android No: ztk::android::Button
Headless No: the namespace does not exist.

Example

set screen [ztk::ios::Screen new -title Save]
$screen add button -text Save -command {apply {{b} {$b configure -enabled 0}}}
$screen add button -text About -style gray
ztk::ios::app root $screen

See also