beetlebug▾
/

menu clone

Makes a copy of the menu with its entries.

PATHNAME clone NEWPATHNAME ?TYPE?

Description

Makes the menu NEWPATHNAME with the options and the entries of the menu. TYPE is the -type of the copy: normal, tearoff, or menubar. Tk uses copies for the menu bars and the torn-off menus.

Returns

An empty string.

Examples

% menu .cl -tearoff 0
> .cl add command -label A
> .cl clone .cl.copy tearoff
> list [.cl.copy index end] [.cl.copy cget -type]
0 tearoff

Errors

% menu .cl2; .cl2 clone
wrong # args: should be ".cl2 clone newMenuName ?menuType?"
-errorcode NONE

% menu .cl3; .cl3 clone .cl3.x bogus
bad type "bogus": must be normal, tearoff, or menubar
-errorcode TCL LOOKUP INDEX type bogus

Facts

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

See also