summaryrefslogtreecommitdiffstats
path: root/doc/menu.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/menu.n')
-rw-r--r--doc/menu.n34
1 files changed, 25 insertions, 9 deletions
diff --git a/doc/menu.n b/doc/menu.n
index 42d1775..a7c52ab 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -356,6 +356,10 @@ Specifies the entry numerically, where 0 corresponds
to the top-most entry of the menu, 1 to the entry below it, and
so on.
.TP 12
+\fIid\fR
+.
+Indicates the entry with the specified id.
+.TP 12
\fIpattern\fR
.
If the index does not satisfy one of the above forms then this
@@ -378,15 +382,18 @@ is specified as \fB{}\fR or \fBnone\fR, or if the specified entry is
disabled, then the menu ends up with no active entry.
Returns an empty string.
.TP
-\fIpathName \fBadd \fItype \fR?\fIoption value option value ...\fR?
+\fIpathName \fBadd \fItype \fR?\fIid\fR? ?\fIoption value option value ...\fR?
.
Add a new entry to the bottom of the menu. The new entry's type
is given by \fItype\fR and must be one of \fBcascade\fR,
\fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR,
-or a unique abbreviation of one of the above. If additional arguments
-are present, they specify the options listed in the \fBMENU ENTRY OPTIONS\fR
-section below.
-The \fBadd\fR widget command returns an empty string.
+or a unique abbreviation of one of the above.
+If the \fIid\fR argument is specified, it is used as the entry identifier;
+\fIid\fR must not already exist in the menu. Otherwise, a new unique
+identifier is generated.
+If additional arguments are present, they specify the options listed in the
+\fBMENU ENTRY OPTIONS\fR section below.
+The \fBadd\fR widget command returns the id of the new entry.
.TP
\fIpathName \fBcget \fIoption\fR
.
@@ -447,19 +454,28 @@ If no \fIoptions\fR are specified, returns a list describing
the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for
information on the format of this list).
.TP
+\fIpathName \fBid \fIindex\fR
+.
+Returns the id of the menu entry given by \fIindex\fR.
+This is the identifier that was assigned to the entry when it was created
+using the \fBadd\fR or \fBinsert\fR widget command.
+Returns an empty string for the tear-off entry, or if \fIindex\fR is
+equivalent to \fB{}\fR.
+.TP
\fIpathName \fBindex \fIindex\fR
.
Returns the numerical index corresponding to \fIindex\fR, or
\fB{}\fR if \fIindex\fR was specified as \fB{}\fR or \fBnone\fR.
.TP
-\fIpathName \fBinsert \fIindex type \fR?\fIoption value option value ...\fR?
+\fIpathName \fBinsert \fIindex type \fR?\fIid\fR? ?\fIoption value option value ...\fR?
.
Same as the \fBadd\fR widget command except that it inserts the new
entry just before the entry given by \fIindex\fR, instead of appending
-to the end of the menu. The \fItype\fR, \fIoption\fR, and \fIvalue\fR
-arguments have the same interpretation as for the \fBadd\fR widget
-command. It is not possible to insert new menu entries before the
+to the end of the menu. The \fItype\fR, \fIid\fR, \fIoption\fR, and
+\fIvalue\fR arguments have the same interpretation as for the \fBadd\fR
+widget command. It is not possible to insert new menu entries before the
tear-off entry, if the menu has one.
+The \fBinsert\fR widget command returns the id of the new entry.
.TP
\fIpathName \fBinvoke \fIindex\fR
.