beetlebug▾
/

menu index

Gives the number of the entry that INDEX names.

PATHNAME index INDEX

Description

Changes an index of any form to a number from 0. An index with no entry, such as end of an empty menu, gives none.

Returns

An integer, or none.

Examples

% menu .ix -tearoff 0
> .ix add command -label Open
> .ix add command -label Save
> .ix index Sa*
1

% menu .ix2 -tearoff 0
> .ix2 index end
none

Errors

% menu .ix3; .ix3 index bogus
bad menu entry index "bogus"
-errorcode NONE

% menu .ix4; .ix4 index
wrong # args: should be ".ix4 index string"
-errorcode NONE

Facts

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

See also