beetlebug▾
/

menu add

Adds an entry of TYPE at the end of the menu.

PATHNAME add TYPE ?OPTION VALUE ...?

Description

TYPE is command, checkbutton, radiobutton, cascade, or separator. The options set the entry:

A separator has the one option -background.

Returns

An empty string.

Examples

% menu .ad -tearoff 0
> .ad add command -label Save -accelerator Ctrl+S
> .ad add checkbutton -label Wrap -variable wrap
> .ad add separator
> list [.ad index end] [.ad type 1]
2 checkbutton

Errors

% menu .ad2; .ad2 add bogus
bad menu entry type "bogus": must be cascade, checkbutton, command, radiobutton, or separator
-errorcode NONE

% menu .ad3; .ad3 add command -bogus 1
unknown option "-bogus"
-errorcode TK LOOKUP OPTION -bogus

% menu .ad4; .ad4 add
wrong # args: should be ".ad4 add type ?-option value ...?"
-errorcode NONE

Facts

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

See also