button invoke

Runs the command of the button, as a click does.

PATHNAME invoke

Description

Runs the -command script of the button at the global level and gives its result. A button with -state disabled runs no script and gives an empty string. An error of the script is the error of invoke. The command runs also with no window on the screen, so a test can drive a button with invoke.

Returns

The result of the -command script, or an empty string.

Examples

% button .iv -command {list a b}
> .iv invoke
a b

% button .iv2 -command {list a b} -state disabled
> .iv2 invoke

Errors

% button .iv3; .iv3 invoke x
wrong # args: should be ".iv3 invoke"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also