Makes a button (Button) that runs a script at a tap, with its text as written and no capitals of the theme.
Synopsis
ztk::android::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 |
filled is the accent color with the color of the window as text. tinted is a light accent with text in the accent. gray and bordered are the button of the theme. plain is text in the accent with no background. |
-enabled |
boolean |
1 |
0 dims the button, and it ignores taps. |
-command |
script |
empty |
Runs at a tap, with the button appended. |
invoke |
method |
|
Runs the action as a tap does. |
-hidden |
boolean |
0 |
1 hides the view, and its column or row closes the gap. |
-accessibilityLabel |
text |
empty |
The name that TalkBack reads: the content description of the view. |
-accessibilityHint |
text |
empty |
Android has no hint for a view: the option keeps its value and has no effect. |
Return value
new gives the object. invoke gives an empty string.
Errors
| Error |
When |
unknown option "-X": must be ... |
The class has no such option. The message lists the options. |
value for "-X" missing |
configure has an option with no value. |
bad style "X": must be bordered, filled, gray, plain, or tinted |
-style has another value. |
expected boolean value but got "X" |
A bad value of -enabled. |
| Platform |
Works |
| Windows |
No |
| macOS |
No |
| Linux, Wayland |
No |
| Linux, X11 |
No |
| Web |
No |
| iOS |
No: ztk::ios::Button |
| Android |
Yes |
| Headless |
No: the namespace does not exist. |
Example
set screen [ztk::android::Screen new -title Save]
$screen add button -text Save -style filled -command {puts saved}
ztk::android::app root $screen
See also