summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-09-06 19:40:01 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-09-06 19:40:01 (GMT)
commite5ee47920e9044f6970c2429d683838877d8ddde (patch)
tree55edde9e27b15d34e0092d4c6b3eff75da6e5b25
parentc9a6593a17cf151dc2bd2aeb8e83eac17ef529f5 (diff)
parent32124ed50e83c59a5144190137414a3c6f5c7fb9 (diff)
downloadtk-e5ee47920e9044f6970c2429d683838877d8ddde.zip
tk-e5ee47920e9044f6970c2429d683838877d8ddde.tar.gz
tk-e5ee47920e9044f6970c2429d683838877d8ddde.tar.bz2
Fixed bug [1581435fff] - Documented precedence order in the matching process of the index string
-rw-r--r--doc/menu.n17
-rw-r--r--tests/menu.test9
2 files changed, 17 insertions, 9 deletions
diff --git a/doc/menu.n b/doc/menu.n
index e26c2d8..1067f38 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -304,16 +304,10 @@ operations on the widget. It has the following general form:
determine the exact behavior of the command.
.PP
Many of the widget commands for a menu take as one argument an
-indicator of which entry of the menu to operate on. These
+indicator of which entry of the menu to operate on. These
indicators are called \fIindex\fRes and may be specified in
any of the following forms:
.TP 12
-\fInumber\fR
-.
-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
\fBactive\fR
.
Indicates the entry that is currently active. If no entry is
@@ -348,6 +342,12 @@ For example,
.QW \fB@0\fR
indicates the top-most entry in the window.
.TP 12
+\fInumber\fR
+.
+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
\fIpattern\fR
.
If the index does not satisfy one of the above forms then this
@@ -356,6 +356,9 @@ each entry in the menu, in order from the top down, until a
matching entry is found. The rules of \fBstring match\fR
are used.
.PP
+If the index could match more than one of the above forms, then
+the form earlier in the above list takes precedence.
+.PP
The following widget commands are possible for menu widgets:
.TP
\fIpathName \fBactivate \fIindex\fR
diff --git a/tests/menu.test b/tests/menu.test
index 595a21b..59239d7 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -1548,10 +1548,15 @@ test menu-3.41 {MenuWidgetCmd procedure, "index" option} -setup {
} -body {
menu .m1
.m1 add command -label "test"
- .m1 index "test"
+ .m1 add command -label "3"
+ .m1 add command -label "another label"
+ .m1 add command -label "end"
+ .m1 add command -label "3a"
+ .m1 add command -label "final entry"
+ list [.m1 index "test"] [.m1 index "3"] [.m1 index "3a"] [.m1 index "end"]
} -cleanup {
destroy .m1
-} -result {1}
+} -result {1 3 5 6}
test menu-3.42 {MenuWidgetCmd procedure, "insert" option} -setup {
destroy .m1
} -body {