beetlebug▾
/

menu invoke

Runs the entry at INDEX, as a click does.

PATHNAME invoke INDEX

Description

A checkbutton entry changes its variable, a radiobutton entry sets its variable, and then the -command script of the entry runs at the global level. A disabled entry, a separator, and none run no script and give an empty string.

Returns

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

Examples

% menu .iv -tearoff 0
> .iv add command -label Hello -command {string toupper hello}
> .iv invoke 0
HELLO

% menu .iv2 -tearoff 0
> .iv2 add checkbutton -label Grid -variable grid -onvalue on -offvalue off
> .iv2 invoke Grid
> set grid
on

Errors

% menu .iv3; .iv3 invoke
wrong # args: should be ".iv3 invoke index"
-errorcode NONE

Facts

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

See also