Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "MENU 1" | |
132 | .TH MENU 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::Menu \- Create and manipulate Menu widgets | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\ \fI$menu\fR = \fI$parent\fR\->\fBMenu\fR(?\fIoptions\fR?); | |
138 | .SH "STANDARD OPTIONS" | |
139 | .IX Header "STANDARD OPTIONS" | |
140 | \&\fB\-activebackground\fR \fB\-background\fR \fB\-disabledforeground\fR \fB\-relief\fR | |
141 | \&\fB\-activeborderwidth\fR \fB\-borderwidth\fR \fB\-font\fR \fB\-takefocus\fR | |
142 | \&\fB\-activeforeground\fR \fB\-cursor\fR \fB\-foreground\fR | |
143 | .PP | |
144 | See Tk::options for details of the standard options. | |
145 | .SH "WIDGET-SPECIFIC OPTIONS" | |
146 | .IX Header "WIDGET-SPECIFIC OPTIONS" | |
147 | .IP "Name: \fBpostCommand\fR" 4 | |
148 | .IX Item "Name: postCommand" | |
149 | .PD 0 | |
150 | .IP "Class: \fBCommand\fR" 4 | |
151 | .IX Item "Class: Command" | |
152 | .IP "Switch: \fB\-postcommand\fR" 4 | |
153 | .IX Item "Switch: -postcommand" | |
154 | .PD | |
155 | If this option is specified then it provides a callback to execute | |
156 | each time the menu is posted. The callback is invoked by the \fBpost\fR | |
157 | method before posting the menu. Note that in 8.0 on Macintosh | |
158 | and Windows, all commands in a menu systems are executed before any | |
159 | are posted. This is due to the limitations in the individual platforms' | |
160 | menu managers. | |
161 | .IP "Name: \fBselectColor\fR" 4 | |
162 | .IX Item "Name: selectColor" | |
163 | .PD 0 | |
164 | .IP "Class: \fBBackground\fR" 4 | |
165 | .IX Item "Class: Background" | |
166 | .IP "Switch: \fB\-selectcolor\fR" 4 | |
167 | .IX Item "Switch: -selectcolor" | |
168 | .PD | |
169 | For menu entries that are check buttons or radio buttons, this option | |
170 | specifies the color to display in the indicator when the check button | |
171 | or radio button is selected. | |
172 | .IP "Name: \fBtearOff\fR" 4 | |
173 | .IX Item "Name: tearOff" | |
174 | .PD 0 | |
175 | .IP "Class: \fBTearOff\fR" 4 | |
176 | .IX Item "Class: TearOff" | |
177 | .IP "Switch: \fB\-tearoff\fR" 4 | |
178 | .IX Item "Switch: -tearoff" | |
179 | .PD | |
180 | This option must have a proper boolean value, which specifies | |
181 | whether or not the menu should include a tear-off entry at the | |
182 | top. If so, it will exist as entry 0 of the menu and the other | |
183 | entries will number starting at 1. The default | |
184 | menu bindings arrange for the menu to be torn off when the tear-off | |
185 | entry is invoked. | |
186 | .IP "Name: \fBtearOffCommand\fR" 4 | |
187 | .IX Item "Name: tearOffCommand" | |
188 | .PD 0 | |
189 | .IP "Class: \fBTearOffCommand\fR" 4 | |
190 | .IX Item "Class: TearOffCommand" | |
191 | .IP "Switch: \fB\-tearoffcommand\fR" 4 | |
192 | .IX Item "Switch: -tearoffcommand" | |
193 | .PD | |
194 | If this option has a non-empty value, then it specifies a perl/Tk callback | |
195 | to invoke whenever the menu is torn off. The actual command will | |
196 | consist of the value of this option, followed by a space, followed | |
197 | by the name of the menu window, followed by a space, followed by | |
198 | the name of the name of the torn off menu window. For example, if | |
199 | the option's is ``\fBa b\fR'' and menu \fB.x.y\fR is torn off to | |
200 | create a new menu \fB.x.tearoff1\fR, then the command | |
201 | ``\fBa b .x.y .x.tearoff1\fR'' will be invoked. | |
202 | .IP "Name: \fBtitle\fR" 4 | |
203 | .IX Item "Name: title" | |
204 | .PD 0 | |
205 | .IP "Class: \fBTitle\fR" 4 | |
206 | .IX Item "Class: Title" | |
207 | .IP "Switch: \fB\-title\fR" 4 | |
208 | .IX Item "Switch: -title" | |
209 | .PD | |
210 | The string will be used to title the window created when this menu is | |
211 | torn off. If the title is \s-1NULL\s0, then the window will have the title | |
212 | of the menubutton or the text of the cascade item from which this menu | |
213 | was invoked. | |
214 | .IP "Name: \fBtype\fR" 4 | |
215 | .IX Item "Name: type" | |
216 | .PD 0 | |
217 | .IP "Class: \fBType\fR" 4 | |
218 | .IX Item "Class: Type" | |
219 | .IP "Switch: \fB\-type\fR" 4 | |
220 | .IX Item "Switch: -type" | |
221 | .PD | |
222 | This option can be one of \fBmenubar\fR, \fBtearoff\fR, or | |
223 | \&\fBnormal\fR, and is set when the menu is created. While the string | |
224 | returned by the configuration database will change if this option is | |
225 | changed, this does not affect the menu widget's behavior. This is used | |
226 | by the cloning mechanism and is not normally set outside of the Tk | |
227 | library. | |
228 | .SH "DESCRIPTION" | |
229 | .IX Header "DESCRIPTION" | |
230 | The \fBMenu\fR method creates a new top-level window (given | |
231 | by the \f(CW$widget\fR argument) and makes it into a menu widget. | |
232 | Additional | |
233 | options, described above, may be specified on the command line | |
234 | or in the option database | |
235 | to configure aspects of the menu such as its colors and font. | |
236 | The \fBmenu\fR command returns its | |
237 | \&\f(CW$widget\fR argument. At the time this command is invoked, | |
238 | there must not exist a window named \f(CW$widget\fR, but | |
239 | \&\f(CW$widget\fR's parent must exist. | |
240 | .PP | |
241 | A menu is a widget that displays a collection of one-line entries arranged | |
242 | in one or more columns. There exist several different types of entries, | |
243 | each with different properties. Entries of different types may be | |
244 | combined in a single menu. Menu entries are not the same as | |
245 | entry widgets. In fact, menu entries are not even distinct widgets; | |
246 | the entire menu is one widget. | |
247 | .PP | |
248 | Menu entries are displayed with up to three separate fields. | |
249 | The main field is a label in the form of a text string, | |
250 | a bitmap, or an image, controlled by the \fB\-label\fR, | |
251 | \&\fB\-bitmap\fR, and \fB\-image\fR options for the entry. | |
252 | If the \fB\-accelerator\fR option is specified for an entry then a second | |
253 | textual field is displayed to the right of the label. The accelerator | |
254 | typically describes a keystroke sequence that may be typed in the | |
255 | application to cause the same result as invoking the menu entry. | |
256 | The third field is an \fIindicator\fR. The indicator is present only for | |
257 | checkbutton or radiobutton entries. It indicates whether the entry | |
258 | is selected or not, and is displayed to the left of the entry's | |
259 | string. | |
260 | .PP | |
261 | In normal use, an entry becomes active (displays itself differently) | |
262 | whenever the mouse pointer is over the entry. If a mouse | |
263 | button is released over the entry then the entry is \fIinvoked\fR. | |
264 | The effect of invocation is different for each type of entry; | |
265 | these effects are described below in the sections on individual | |
266 | entries. | |
267 | .PP | |
268 | Entries may be \fIdisabled\fR, which causes their labels | |
269 | and accelerators to be displayed | |
270 | with dimmer colors. | |
271 | The default menu bindings will not allow | |
272 | a disabled entry to be activated or invoked. | |
273 | Disabled entries may be re\-enabled, at which point it becomes | |
274 | possible to activate and invoke them again. | |
275 | .PP | |
276 | Whenever a menu's active entry is changed, a <<MenuSelect>> virtual | |
277 | event is sent to the menu. The active item can then be queried from | |
278 | the menu, and an action can be taken, such as setting | |
279 | context-sensitive help text for the entry. | |
280 | .Sh "\s-1COMMAND\s0 \s-1ENTRIES\s0" | |
281 | .IX Subsection "COMMAND ENTRIES" | |
282 | The most common kind of menu entry is a command entry, which | |
283 | behaves much like a button widget. When a command entry is | |
284 | invoked, a callback is executed. The callback | |
285 | is specified with the \fB\-command\fR option. | |
286 | .Sh "\s-1SEPARATOR\s0 \s-1ENTRIES\s0" | |
287 | .IX Subsection "SEPARATOR ENTRIES" | |
288 | A separator is an entry that is displayed as a horizontal dividing | |
289 | line. A separator may not be activated or invoked, and it has | |
290 | no behavior other than its display appearance. | |
291 | .Sh "\s-1CHECKBUTTON\s0 \s-1ENTRIES\s0" | |
292 | .IX Subsection "CHECKBUTTON ENTRIES" | |
293 | A checkbutton menu entry behaves much like a checkbutton widget. | |
294 | When it is invoked it toggles back and forth between the selected | |
295 | and deselected states. When the entry is selected, a particular | |
296 | value is stored in a particular global variable (as determined by | |
297 | the \fB\-onvalue\fR and \fB\-variable\fR options for the entry); when | |
298 | the entry is deselected another value (determined by the | |
299 | \&\fB\-offvalue\fR option) is stored in the global variable. | |
300 | An indicator box is displayed to the left of the label in a checkbutton | |
301 | entry. If the entry is selected then the indicator's center is displayed | |
302 | in the color given by the \fB\-selectcolor\fR option for the entry; | |
303 | otherwise the indicator's center is displayed in the background color for | |
304 | the menu. If a \fB\-command\fR option is specified for a checkbutton | |
305 | entry, then its value is evaluated each time the entry | |
306 | is invoked; this happens after toggling the entry's | |
307 | selected state. | |
308 | .Sh "\s-1RADIOBUTTON\s0 \s-1ENTRIES\s0" | |
309 | .IX Subsection "RADIOBUTTON ENTRIES" | |
310 | A radiobutton menu entry behaves much like a radiobutton widget. | |
311 | Radiobutton entries are organized in groups of which only one | |
312 | entry may be selected at a time. Whenever a particular entry | |
313 | becomes selected it stores a particular value into a particular | |
314 | global variable (as determined by the \fB\-value\fR and | |
315 | \&\fB\-variable\fR options for the entry). This action | |
316 | causes any previously-selected entry in the same group | |
317 | to deselect itself. | |
318 | Once an entry has become selected, any change to the entry's | |
319 | associated variable will cause the entry to deselect itself. | |
320 | Grouping of radiobutton entries is determined by their | |
321 | associated variables: if two entries have the same associated | |
322 | variable then they are in the same group. | |
323 | An indicator diamond is displayed to the left of the label in each | |
324 | radiobutton entry. If the entry is selected then the indicator's | |
325 | center is displayed in the color given by the \fB\-selectcolor\fR option | |
326 | for the entry; | |
327 | otherwise the indicator's center is displayed in the background color for | |
328 | the menu. If a \fB\-command\fR option is specified for a radiobutton | |
329 | entry, then its value is evaluated each time the entry | |
330 | is invoked; this happens after selecting the entry. | |
331 | .Sh "\s-1CASCADE\s0 \s-1ENTRIES\s0" | |
332 | .IX Subsection "CASCADE ENTRIES" | |
333 | A cascade entry is one with an associated menu (determined | |
334 | by the \fB\-menu\fR option). Cascade entries allow the construction | |
335 | of cascading menus. | |
336 | The \fBpostcascade\fR method can be used to post and unpost | |
337 | the associated menu just next to of the cascade entry. | |
338 | The associated menu must be a child of the menu containing | |
339 | the cascade entry (this is needed in order for menu traversal to | |
340 | work correctly). | |
341 | .PP | |
342 | A cascade entry posts its associated menu by invoking | |
343 | .Sp | |
344 | .RS 4 | |
345 | \&\fI$menu\fR\->\fBpost\fR(\fIx,y\fR) | |
346 | .RE | |
347 | .PP | |
348 | where \fImenu\fR is the path name of the associated menu, and \fIx\fR | |
349 | and \fIy\fR are the root-window coordinates of the upper-right | |
350 | corner of the cascade entry. | |
351 | On Unix, the lower-level menu is unposted by executing | |
352 | .Sp | |
353 | .RS 4 | |
354 | \&\fI$menu\fR\->\fBunpost\fR | |
355 | .RE | |
356 | .PP | |
357 | where \fImenu\fR is the name of the associated menu. | |
358 | On other platforms, the platform's native code takes care of unposting the | |
359 | menu. | |
360 | .PP | |
361 | If a \fB\-command\fR option is specified for a cascade entry then it is | |
362 | evaluated whenever the entry is invoked. This is not supported on Windows. | |
363 | .Sh "TEAR-OFF \s-1ENTRIES\s0" | |
364 | .IX Subsection "TEAR-OFF ENTRIES" | |
365 | A tear-off entry appears at the top of the menu if enabled with the | |
366 | \&\fBtearOff\fR option. It is not like other menu entries in that | |
367 | it cannot be created with the \fBadd\fR method and | |
368 | cannot be deleted with the \fBdelete\fR method. | |
369 | When a tear-off entry is created it appears as a dashed line at | |
370 | the top of the menu. Under the default bindings, invoking the | |
371 | tear-off entry causes a torn-off copy to be made of the menu and | |
372 | all of its submenus. | |
373 | .Sh "\s-1MENUBARS\s0" | |
374 | .IX Subsection "MENUBARS" | |
375 | Any menu can be set as a menubar for a toplevel window (see the | |
376 | Toplevel constructor for syntax). On the Macintosh, whenever the | |
377 | toplevel is in front, this menu's cascade items will appear in the | |
378 | menubar across the top of the main monitor. On Windows and Unix, this | |
379 | menu's items will be displayed in a menubar accross the top of the | |
380 | window. These menus will behave according to the interface guidelines | |
381 | of their platforms. For every menu set as a menubar, a clone menu is | |
382 | made. See \*(L"\s-1CLONES\s0\*(R" for more information. | |
383 | .Sh "\s-1SPECIAL\s0 \s-1MENUS\s0 \s-1IN\s0 \s-1MENUBARS\s0" | |
384 | .IX Subsection "SPECIAL MENUS IN MENUBARS" | |
385 | Certain menus in a menubar will be treated specially. On the Macintosh, | |
386 | access to the special Apple and Help menus is provided. On Windows, | |
387 | access to the Windows System menu in each window is provided. On X Windows, | |
388 | a special right-justified help menu is provided. In all cases, these | |
389 | menus must be created with the command name of the menubar menu concatenated | |
390 | with the special name. So for a menubar named .menubar, on the Macintosh, | |
391 | the special menus would be .menubar.apple and .menubar.help; on Windows, | |
392 | the special menu would be .menubar.system; on X Windows, the help | |
393 | menu would be .menubar.help. | |
394 | .PP | |
395 | When Tk sees an Apple menu on the Macintosh, that menu's contents make | |
396 | up the first items of the Apple menu on the screen whenever the window | |
397 | containing the menubar is in front. The menu is the | |
398 | first one that the user sees and has a title which is an Apple logo. | |
399 | After all of the Tk-defined items, the menu will have a separator, | |
400 | followed by all of the items in the user's Apple Menu Items folder. | |
401 | Since the System uses a different menu definition procedure for | |
402 | the Apple menu than Tk uses for its menus, and the system APIs do | |
403 | not fully support everything Tk tries to do, the menu item will only | |
404 | have its text displayed. No font attributes, images, bitmaps, or colors | |
405 | will be displayed. In addition, a menu with a tearoff item will have | |
406 | the tearoff item displayed as \*(L"(TearOff)\*(R". | |
407 | .PP | |
408 | When Tk see a Help menu on the Macintosh, the menu's contents are | |
409 | appended to the standard help menu on the right of the user's menubar | |
410 | whenever the user's menubar is in front. The first items in the menu | |
411 | are provided by Apple. Similar to the Apple Menu, cusomization in this | |
412 | menu is limited to what the system provides. | |
413 | .PP | |
414 | When Tk sees a System menu on Windows, its items are appended to the | |
415 | system menu that the menubar is attached to. This menu has an icon | |
416 | representing a spacebar, and can be invoked with the mouse or by typing | |
417 | Alt+Spacebar. Due to limitations in the Windows \s-1API\s0, any font changes, | |
418 | colors, images, bitmaps, or tearoff images will not appear in the | |
419 | system menu. | |
420 | .PP | |
421 | When Tk see a Help menu on X Windows, the menu is moved to be last in | |
422 | the menubar and is right justified. | |
423 | .Sh "\s-1SEPARATORS\s0 \s-1IN\s0 \s-1MENUBARS\s0" | |
424 | .IX Subsection "SEPARATORS IN MENUBARS" | |
425 | Separator entries are not displayed in menubars. | |
426 | The \fIlast\fR separator entry causes remaining entries to be | |
427 | right justified. | |
428 | .Sh "\s-1CLONES\s0" | |
429 | .IX Subsection "CLONES" | |
430 | When a menu is set as a menubar for a toplevel window, or when a menu | |
431 | is torn off, a clone of the menu is made. This clone is a menu widget | |
432 | in its own right, but it is a child of the original. Changes in the | |
433 | configuration of the original are reflected in the | |
434 | clone. Additionally, any cascades that are pointed to are also cloned | |
435 | so that menu traversal will work right. Clones are destroyed when | |
436 | either the tearoff or menubar goes away, or when the original menu is | |
437 | destroyed. | |
438 | .Sh "\s-1WIDGET\s0 \s-1METHODS\s0" | |
439 | .IX Subsection "WIDGET METHODS" | |
440 | The \fBMenu\fR method creates a widget object. | |
441 | This object supports the \fBconfigure\fR and \fBcget\fR methods | |
442 | described in Tk::options which can be used to enquire and | |
443 | modify the options described above. | |
444 | The widget also inherits all the methods provided by the generic | |
445 | Tk::Widget class, and the Tk::Wm class. | |
446 | .PP | |
447 | Many of the methods for a menu take as one argument an | |
448 | indicator of which entry of the menu to operate on. These | |
449 | indicators are called \fIindex\fRes and may be specified in | |
450 | any of the following forms: | |
451 | .IP "\fInumber\fR" 4 | |
452 | .IX Item "number" | |
453 | Specifies the entry numerically, where 0 corresponds | |
454 | to the top-most entry of the menu, 1 to the entry below it, and | |
455 | so on. | |
456 | .IP "\fBactive\fR" 4 | |
457 | .IX Item "active" | |
458 | Indicates the entry that is currently active. If no entry is | |
459 | active then this form is equivalent to \fBnone\fR. This form may | |
460 | not be abbreviated. | |
461 | .IP "\fBend\fR" 4 | |
462 | .IX Item "end" | |
463 | Indicates the bottommost entry in the menu. If there are no | |
464 | entries in the menu then this form is equivalent to \fBnone\fR. | |
465 | This form may not be abbreviated. | |
466 | .IP "\fBlast\fR" 4 | |
467 | .IX Item "last" | |
468 | Same as \fBend\fR. | |
469 | .IP "\fBnone\fR" 4 | |
470 | .IX Item "none" | |
471 | Indicates ``no entry at all''; this is used most commonly with | |
472 | the \fBactivate\fR option to deactivate all the entries in the | |
473 | menu. In most cases the specification of \fBnone\fR causes | |
474 | nothing to happen in the method. | |
475 | This form may not be abbreviated. | |
476 | .IP "\fB@\fR\fInumber\fR" 4 | |
477 | .IX Item "@number" | |
478 | In this form, \fInumber\fR is treated as a y\-coordinate in the | |
479 | menu's window; the entry closest to that y\-coordinate is used. | |
480 | For example, ``\fB@0\fR'' indicates the top-most entry in the | |
481 | window. | |
482 | .IP "\fIpattern\fR" 4 | |
483 | .IX Item "pattern" | |
484 | If the index doesn't satisfy one of the above forms then this | |
485 | form is used. \fIPattern\fR is pattern-matched against the label of | |
486 | each entry in the menu, in order from the top down, until a | |
487 | matching entry is found. | |
488 | (In perl/Tk the matching is under review, but exact match | |
489 | should work.) | |
490 | .PP | |
491 | The following methods are possible for menu widgets: | |
492 | .IP "\fI$menu\fR\->\fBactivate\fR(\fIindex\fR)" 4 | |
493 | .IX Item "$menu->activate(index)" | |
494 | Change the state of the entry indicated by \fIindex\fR to \fBactive\fR | |
495 | and redisplay it using its active colors. | |
496 | Any previously-active entry is deactivated. If \fIindex\fR | |
497 | is specified as \fBnone\fR, or if the specified entry is | |
498 | disabled, then the menu ends up with no active entry. | |
499 | Returns an empty string. | |
500 | .IP "\fI$menu\fR\->\fBadd\fR(\fItype, \fR?\fIoption, value, option, value, ...\fR?)" 4 | |
501 | .IX Item "$menu->add(type, ?option, value, option, value, ...?)" | |
502 | Add a new entry to the bottom of the menu. The new entry's type | |
503 | is given by \fItype\fR and must be one of \fBcascade\fR, | |
504 | \&\fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR, | |
505 | or a unique abbreviation of one of the above. If additional arguments | |
506 | are present, they specify any of the following options: | |
507 | .RS 4 | |
508 | .IP "\fB\-activebackground\fR => \fIvalue\fR" 8 | |
509 | .IX Item "-activebackground => value" | |
510 | Specifies a background color to use for displaying this entry when it | |
511 | is active. | |
512 | If this option is specified as an empty string (the default), then the | |
513 | \&\fBactiveBackground\fR option for the overall menu is used. | |
514 | If the \fB$Tk::strictMotif\fR variable has been set to request strict | |
515 | Motif compliance, then this option is ignored and the \fB\-background\fR | |
516 | option is used in its place. | |
517 | This option is not available for separator or tear-off entries. | |
518 | .IP "\fB\-activeforeground\fR => \fIvalue\fR" 8 | |
519 | .IX Item "-activeforeground => value" | |
520 | Specifies a foreground color to use for displaying this entry when it | |
521 | is active. | |
522 | If this option is specified as an empty string (the default), then the | |
523 | \&\fBactiveForeground\fR option for the overall menu is used. | |
524 | This option is not available for separator or tear-off entries. | |
525 | .IP "\fB\-accelerator\fR => \fIvalue\fR" 8 | |
526 | .IX Item "-accelerator => value" | |
527 | Specifies a string to display at the right side of the menu entry. | |
528 | Normally describes an accelerator keystroke sequence that may be | |
529 | typed to invoke the same function as the menu entry. This option | |
530 | is not available for separator or tear-off entries. | |
531 | .IP "\fB\-background\fR => \fIvalue\fR" 8 | |
532 | .IX Item "-background => value" | |
533 | Specifies a background color to use for displaying this entry when it | |
534 | is in the normal state (neither active nor disabled). | |
535 | If this option is specified as an empty string (the default), then the | |
536 | \&\fBbackground\fR option for the overall menu is used. | |
537 | This option is not available for separator or tear-off entries. | |
538 | .IP "\fB\-bitmap\fR => \fIvalue\fR" 8 | |
539 | .IX Item "-bitmap => value" | |
540 | Specifies a bitmap to display in the menu instead of a textual | |
541 | label, in any of the forms accepted by \fBTk_GetBitmap\fR. | |
542 | This option overrides the \fB\-label\fR option but may be reset | |
543 | to an empty string to enable a textual label to be displayed. | |
544 | If a \fB\-image\fR option has been specified, it overrides | |
545 | \&\fB\-bitmap\fR. | |
546 | This option is not available for separator or tear-off entries. | |
547 | .IP "\fB\-columnbreak\fR => \fIvalue\fR" 8 | |
548 | .IX Item "-columnbreak => value" | |
549 | When this option is zero, the appears below the previous entry. When | |
550 | this option is one, the menu appears at the top of a new column in the | |
551 | menu. | |
552 | .IP "\fB\-command\fR => \fIvalue\fR" 8 | |
553 | .IX Item "-command => value" | |
554 | For command, checkbutton, and radiobutton entries, specifies a | |
555 | callback to execute when the menu entry is invoked. | |
556 | For cascade entries, specifies a callback to execute | |
557 | when the entry is activated (i.e. just before its submenu is | |
558 | posted). | |
559 | Not available for separator or tear-off entries. | |
560 | .IP "\fB\-font\fR => \fIvalue\fR" 8 | |
561 | .IX Item "-font => value" | |
562 | Specifies the font to use when drawing the label or accelerator | |
563 | string in this entry. | |
564 | If this option is specified as an empty string (the default) then | |
565 | the \fBfont\fR option for the overall menu is used. | |
566 | This option is not available for separator or tear-off entries. | |
567 | .IP "\fB\-foreground\fR => \fIvalue\fR" 8 | |
568 | .IX Item "-foreground => value" | |
569 | Specifies a foreground color to use for displaying this entry when it | |
570 | is in the normal state (neither active nor disabled). | |
571 | If this option is specified as an empty string (the default), then the | |
572 | \&\fBforeground\fR option for the overall menu is used. | |
573 | This option is not available for separator or tear-off entries. | |
574 | .IP "\fB\-hidemargin\fR => \fIvalue\fR" 8 | |
575 | .IX Item "-hidemargin => value" | |
576 | Specifies whether the standard margins should be drawn for this menu | |
577 | entry. This is useful when creating palette with images in them, i.e., | |
578 | color palettes, pattern palettes, etc. 1 indicates that the margin for | |
579 | the entry is hidden; 0 means that the margin is used. | |
580 | .IP "\fB\-image\fR => \fIvalue\fR" 8 | |
581 | .IX Item "-image => value" | |
582 | Specifies an image to display in the menu instead of a text string | |
583 | or bitmap | |
584 | The image must have been created by some previous invocation of | |
585 | \&\fBimage create\fR. | |
586 | This option overrides the \fB\-label\fR and \fB\-bitmap\fR options | |
587 | but may be reset to an empty string to enable a textual or | |
588 | bitmap label to be displayed. | |
589 | This option is not available for separator or tear-off entries. | |
590 | .IP "\fB\-indicatoron\fR => \fIvalue\fR" 8 | |
591 | .IX Item "-indicatoron => value" | |
592 | Available only for checkbutton and radiobutton entries. | |
593 | \&\fIValue\fR is a boolean that determines whether or not the | |
594 | indicator should be displayed. | |
595 | .IP "\fB\-label\fR => \fIvalue\fR" 8 | |
596 | .IX Item "-label => value" | |
597 | Specifies a string to display as an identifying label in the menu | |
598 | entry. Not available for separator or tear-off entries. | |
599 | .IP "\fB\-menu\fR => \fIvalue\fR" 8 | |
600 | .IX Item "-menu => value" | |
601 | Available only for cascade entries. Specifies the path name of | |
602 | the submenu associated with this entry. | |
603 | The submenu must be a child of the menu. | |
604 | .IP "\fB\-offvalue\fR => \fIvalue\fR" 8 | |
605 | .IX Item "-offvalue => value" | |
606 | Available only for checkbutton entries. Specifies the value to | |
607 | store in the entry's associated variable when the entry is | |
608 | deselected. | |
609 | .IP "\fB\-onvalue\fR => \fIvalue\fR" 8 | |
610 | .IX Item "-onvalue => value" | |
611 | Available only for checkbutton entries. Specifies the value to | |
612 | store in the entry's associated variable when the entry is selected. | |
613 | .IP "\fB\-selectcolor\fR => \fIvalue\fR" 8 | |
614 | .IX Item "-selectcolor => value" | |
615 | Available only for checkbutton and radiobutton entries. | |
616 | Specifies the color to display in the indicator when the entry is | |
617 | selected. | |
618 | If the value is an empty string (the default) then the \fBselectColor\fR | |
619 | option for the menu determines the indicator color. | |
620 | .IP "\fB\-selectimage\fR => \fIvalue\fR" 8 | |
621 | .IX Item "-selectimage => value" | |
622 | Available only for checkbutton and radiobutton entries. | |
623 | Specifies an image to display in the entry (in place of | |
624 | the \fB\-image\fR option) when it is selected. | |
625 | \&\fIValue\fR is the name of an image, which must have been created | |
626 | by some previous invocation of \fBimage create\fR. | |
627 | This option is ignored unless the \fB\-image\fR option has | |
628 | been specified. | |
629 | .IP "\fB\-state\fR => \fIvalue\fR" 8 | |
630 | .IX Item "-state => value" | |
631 | Specifies one of three states for the entry: \fBnormal\fR, \fBactive\fR, | |
632 | or \fBdisabled\fR. In normal state the entry is displayed using the | |
633 | \&\fBforeground\fR option for the menu and the \fBbackground\fR | |
634 | option from the entry or the menu. | |
635 | The active state is typically used when the pointer is over the entry. | |
636 | In active state the entry is displayed using the \fBactiveForeground\fR | |
637 | option for the menu along with the \fBactivebackground\fR option from | |
638 | the entry. Disabled state means that the entry | |
639 | should be insensitive: the default bindings will refuse to activate | |
640 | or invoke the entry. | |
641 | In this state the entry is displayed according to the | |
642 | \&\fBdisabledForeground\fR option for the menu and the | |
643 | \&\fBbackground\fR option from the entry. | |
644 | This option is not available for separator entries. | |
645 | .IP "\fB\-underline\fR => \fIvalue\fR" 8 | |
646 | .IX Item "-underline => value" | |
647 | Specifies the integer index of a character to underline in the entry. | |
648 | This option is also queried by the default bindings and used to | |
649 | implement keyboard traversal. | |
650 | 0 corresponds to the first character of the text displayed in the entry, | |
651 | 1 to the next character, and so on. | |
652 | If a bitmap or image is displayed in the entry then this option is ignored. | |
653 | This option is not available for separator or tear-off entries. | |
654 | .IP "\fB\-value\fR => \fIvalue\fR" 8 | |
655 | .IX Item "-value => value" | |
656 | Available only for radiobutton entries. Specifies the value to | |
657 | store in the entry's associated variable when the entry is selected. | |
658 | If an empty string is specified, then the \fB\-label\fR option | |
659 | for the entry as the value to store in the variable. | |
660 | .IP "\fB\-variable\fR => \fIvalue\fR" 8 | |
661 | .IX Item "-variable => value" | |
662 | Available only for checkbutton and radiobutton entries. Specifies | |
663 | the name of a global value to set when the entry is selected. | |
664 | For checkbutton entries the variable is also set when the entry | |
665 | is deselected. For radiobutton entries, changing the variable | |
666 | causes the currently-selected entry to deselect itself. | |
667 | .RE | |
668 | .RS 4 | |
669 | .Sp | |
670 | The \fBadd\fR method returns an empty string. | |
671 | .RE | |
672 | .IP "\fI$menu\fR\->\fBclone\fR(\fI$parent\fR ?, \fIcloneType?\fR)" 4 | |
673 | .IX Item "$menu->clone($parent ?, cloneType?)" | |
674 | Makes a clone of the current menu as a child of \fI$parent\fR. This clone | |
675 | is a menu in its own right, but any changes to the clone are | |
676 | propogated to the original menu and vice versa. \fIcloneType\fR can be | |
677 | \&\fBnormal\fR, \fBmenubar\fR, or \fBtearoff\fR. Should not normally be | |
678 | called outside of the Tk library. See \*(L"\s-1CLONES\s0\*(R" for | |
679 | more information. | |
680 | .IP "\fI$menu\fR\->\fBdelete\fR(\fIindex1\fR?, \fIindex2\fR?)" 4 | |
681 | .IX Item "$menu->delete(index1?, index2?)" | |
682 | Delete all of the menu entries between \fIindex1\fR and | |
683 | \&\fIindex2\fR inclusive. | |
684 | If \fIindex2\fR is omitted then it defaults to \fIindex1\fR. | |
685 | Attempts to delete a tear-off menu entry are ignored (instead, you | |
686 | should change the \fBtearOff\fR option to remove the tear-off entry). | |
687 | .IP "\fI$menu\fR\->\fBentrycget\fR(\fIindex, option\fR)" 4 | |
688 | .IX Item "$menu->entrycget(index, option)" | |
689 | Returns the current value of a configuration option for | |
690 | the entry given by \fIindex\fR. | |
691 | \&\fIOption\fR may have any of the values accepted by the \fBadd\fR | |
692 | method. | |
693 | .IP "\fI$menu\fR\->\fBentryconfigure\fR(\fIindex\fR ?,\fIoptions\fR?)" 4 | |
694 | .IX Item "$menu->entryconfigure(index ?,options?)" | |
695 | This method is similar to the \fBconfigure\fR method, except that | |
696 | it applies to the options for an individual entry, whereas \fBconfigure\fR | |
697 | applies to the options for the menu as a whole. | |
698 | \&\fIOptions\fR may have any of the values accepted by the \fBadd\fR | |
699 | method. If \fIoptions\fR are specified, options are modified | |
700 | as indicated | |
701 | in the method call and the method returns an empty string. | |
702 | If no \fIoptions\fR are specified, returns a list describing | |
703 | the current options for entry \fIindex\fR (see Tk::options for | |
704 | information on the format of this list). | |
705 | .IP "\fI$menu\fR\->\fBindex\fR(\fIindex\fR)" 4 | |
706 | .IX Item "$menu->index(index)" | |
707 | Returns the numerical index corresponding to \fIindex\fR, or | |
708 | \&\fBnone\fR if \fIindex\fR was specified as \fBnone\fR. | |
709 | .IP "\fI$menu\fR\->\fBinsert\fR(\fIindex, type\fR?, \fI\-option\fR=>\fIvalue\fR, ...?)" 4 | |
710 | .IX Item "$menu->insert(index, type?, -option=>value, ...?)" | |
711 | Same as the \fBadd\fR method except that it inserts the new | |
712 | entry just before the entry given by \fIindex\fR, instead of appending | |
713 | to the end of the menu. The \fItype\fR, \fI\-option\fR, and \fIvalue\fR | |
714 | arguments have the same interpretation as for the \fBadd\fR widget | |
715 | method. It is not possible to insert new menu entries before the | |
716 | tear-off entry, if the menu has one. | |
717 | .IP "\fI$menu\fR\->\fBinvoke\fR(\fIindex\fR)" 4 | |
718 | .IX Item "$menu->invoke(index)" | |
719 | Invoke the action of the menu entry. See the sections on the | |
720 | individual entries above for details on what happens. If the | |
721 | menu entry is disabled then nothing happens. If the | |
722 | entry has a callback associated with it then the result of that | |
723 | callback is returned as the result of the \fBinvoke\fR widget | |
724 | method. Otherwise the result is an empty string. Note: invoking | |
725 | a menu entry does not automatically unpost the menu; the default | |
726 | bindings normally take care of this before invoking the \fBinvoke\fR | |
727 | method. | |
728 | .IP "\fI$menu\fR\->\fBpost\fR(\fIx, y\fR)" 4 | |
729 | .IX Item "$menu->post(x, y)" | |
730 | Arrange for the menu to be displayed on the screen at the root-window | |
731 | coordinates given by \fIx\fR and \fIy\fR. These coordinates are | |
732 | adjusted if necessary to guarantee that the entire menu is visible on | |
733 | the screen. This method normally returns an empty string. | |
734 | If the \fBpostCommand\fR option has been specified, then its value is | |
735 | executed before posting the menu and the result of | |
736 | that callback is returned as the result of the \fBpost\fR widget | |
737 | method. | |
738 | If an error returns while executing the method, then the error is | |
739 | returned without posting the menu. | |
740 | .IP "\fI$menu\fR\->\fBpostcascade\fR(\fIindex\fR)" 4 | |
741 | .IX Item "$menu->postcascade(index)" | |
742 | Posts the submenu associated with the cascade entry given by | |
743 | \&\fIindex\fR, and unposts any previously posted submenu. | |
744 | If \fIindex\fR doesn't correspond to a cascade entry, | |
745 | or if \fI$menu\fR isn't posted, | |
746 | the method has no effect except to unpost any currently posted | |
747 | submenu. | |
748 | .IP "\fI$menu\fR\->\fBtype\fR(\fIindex\fR)" 4 | |
749 | .IX Item "$menu->type(index)" | |
750 | Returns the type of the menu entry given by \fIindex\fR. | |
751 | This is the \fItype\fR argument passed to the \fBadd\fR widget | |
752 | method when the entry was created, such as \fBcommand\fR | |
753 | or \fBseparator\fR, or \fBtearoff\fR for a tear-off entry. | |
754 | .IP "\fI$menu\fR\->\fBunpost\fR" 4 | |
755 | .IX Item "$menu->unpost" | |
756 | Unmap the window so that it is no longer displayed. If a | |
757 | lower-level cascaded menu is posted, unpost that menu. Returns an | |
758 | empty string. This method does not work on Windows and the | |
759 | Macintosh, as those platforms have their own way of unposting menus. | |
760 | .IP "\fI$menu\fR\->\fByposition\fR(\fIindex\fR)" 4 | |
761 | .IX Item "$menu->yposition(index)" | |
762 | Returns a decimal string giving the y\-coordinate within the menu | |
763 | window of the topmost pixel in the entry specified by \fIindex\fR. | |
764 | .SH "MENU CONFIGURATIONS" | |
765 | .IX Header "MENU CONFIGURATIONS" | |
766 | The default bindings support four different ways of using menus: | |
767 | .IP "\fBPulldown Menus in Menubar\fR" 4 | |
768 | .IX Item "Pulldown Menus in Menubar" | |
769 | This is the most command case. You create a menu widget that will become the | |
770 | menu bar. You then add cascade entries to this menu, specifying the | |
771 | pull down menus you wish to use in your menu bar. You then create all | |
772 | of the pulldowns. Once you have done this, specify the menu using the | |
773 | \&\fB\-menu\fR option of the toplevel's method. See the | |
774 | \&\fBtoplevel\fR manual entry for details. | |
775 | .IP "\fBPulldown Menus in Menu Buttons\fR" 4 | |
776 | .IX Item "Pulldown Menus in Menu Buttons" | |
777 | This is the compatable way to do menu bars. You create one menubutton | |
778 | widget for each top-level menu, and typically you arrange a series of | |
779 | menubuttons in a row in a menubar window. You also create the top-level menus | |
780 | and any cascaded submenus, and tie them together with \fB\-menu\fR | |
781 | options in menubuttons and cascade menu entries. The top-level menu must | |
782 | be a child of the menubutton, and each submenu must be a child of the | |
783 | menu that refers to it. Once you have done this, the default bindings | |
784 | will allow users to traverse and invoke the tree of menus via its | |
785 | menubutton; see the \fBmenubutton\fR documentation for details. | |
786 | .IP "\fBPopup Menus\fR" 4 | |
787 | .IX Item "Popup Menus" | |
788 | Popup menus typically post in response to a mouse button press or | |
789 | keystroke. You create the popup menus and any cascaded submenus, | |
790 | then you call the \fBPost\fR method at the appropriate time | |
791 | to post the top-level menu. | |
792 | .Sp | |
793 | \&\fI$menu\fR\->\fBPost\fR(\fI$x\fR,\fI$y\fR?,\fI$entry\fR?) | |
794 | .Sp | |
795 | \&\fI$x\fR and \fI$y\fR are the root window coordinates at which the \fI$menu\fR | |
796 | will be displayed. If \fI$entry\fR is specified then that entry is centred | |
797 | on that point, otherwise the top-left corner of the \fI$menu\fR is placed | |
798 | at that point. | |
799 | .Sp | |
800 | \&\fBMenu\fR also inherits methods from Tk::Wm and so the method | |
801 | \&\fBPopup\fR can be used to position menu relative to other windows, the | |
802 | mouse cursor or the screen. | |
803 | .IP "\fBOption Menus\fR" 4 | |
804 | .IX Item "Option Menus" | |
805 | An option menu consists of a menubutton with an associated menu | |
806 | that allows you to select one of several values. The current value | |
807 | is displayed in the menubutton and is also stored in a global | |
808 | variable. Use the Tk::Optionmenu class to create option | |
809 | menubuttons and their menus. | |
810 | .IP "\fBTorn-off Menus\fR" 4 | |
811 | .IX Item "Torn-off Menus" | |
812 | You create a torn-off menu by invoking the tear-off entry at | |
813 | the top of an existing menu. The default bindings will create a new menu | |
814 | that is a copy of the original menu and leave it permanently | |
815 | posted as a top-level window. The torn-off menu behaves just | |
816 | the same as the original menu. | |
817 | .SH "DEFAULT BINDINGS" | |
818 | .IX Header "DEFAULT BINDINGS" | |
819 | Tk automatically creates class bindings for menus that give them | |
820 | the following default behavior: | |
821 | .IP "[1]" 4 | |
822 | .IX Item "[1]" | |
823 | When the mouse enters a menu, the entry underneath the mouse | |
824 | cursor activates; as the mouse moves around the menu, the active | |
825 | entry changes to track the mouse. | |
826 | .IP "[2]" 4 | |
827 | .IX Item "[2]" | |
828 | When the mouse leaves a menu all of the entries in the menu | |
829 | deactivate, except in the special case where the mouse moves from | |
830 | a menu to a cascaded submenu. | |
831 | .IP "[3]" 4 | |
832 | .IX Item "[3]" | |
833 | When a button is released over a menu, the active entry (if any) is invoked. | |
834 | The menu also unposts unless it is a torn-off menu. | |
835 | .IP "[4]" 4 | |
836 | .IX Item "[4]" | |
837 | The Space and Return keys invoke the active entry and | |
838 | unpost the menu. | |
839 | .IP "[5]" 4 | |
840 | .IX Item "[5]" | |
841 | If any of the entries in a menu have letters underlined with | |
842 | with \fB\-underline\fR option, then pressing one of the underlined | |
843 | letters (or its upper-case or lower-case equivalent) invokes that | |
844 | entry and unposts the menu. | |
845 | .IP "[6]" 4 | |
846 | .IX Item "[6]" | |
847 | The Escape key aborts a menu selection in progress without invoking any | |
848 | entry. It also unposts the menu unless it is a torn-off menu. | |
849 | .IP "[7]" 4 | |
850 | .IX Item "[7]" | |
851 | The Up and Down keys activate the next higher or lower entry | |
852 | in the menu. When one end of the menu is reached, the active | |
853 | entry wraps around to the other end. | |
854 | .IP "[8]" 4 | |
855 | .IX Item "[8]" | |
856 | The Left key moves to the next menu to the left. | |
857 | If the current menu is a cascaded submenu, then the submenu is | |
858 | unposted and the current menu entry becomes the cascade entry | |
859 | in the parent. | |
860 | If the current menu is a top-level menu posted from a | |
861 | menubutton, then the current menubutton is unposted and the | |
862 | next menubutton to the left is posted. | |
863 | Otherwise the key has no effect. | |
864 | The left-right order of menubuttons is determined by their stacking | |
865 | order: Tk assumes that the lowest menubutton (which by default | |
866 | is the first one created) is on the left. | |
867 | .IP "[9]" 4 | |
868 | .IX Item "[9]" | |
869 | The Right key moves to the next menu to the right. | |
870 | If the current entry is a cascade entry, then the submenu is | |
871 | posted and the current menu entry becomes the first entry | |
872 | in the submenu. | |
873 | Otherwise, if the current menu was posted from a | |
874 | menubutton, then the current menubutton is unposted and the | |
875 | next menubutton to the right is posted. | |
876 | .Sp | |
877 | Disabled menu entries are non\-responsive: they don't activate and | |
878 | they ignore mouse button presses and releases. | |
879 | .Sp | |
880 | The behavior of menus can be changed by defining new bindings for | |
881 | individual widgets or by redefining the class bindings. | |
882 | .SH "BUGS" | |
883 | .IX Header "BUGS" | |
884 | At present it isn't possible to use the | |
885 | option database to specify values for the options to individual | |
886 | entries. | |
887 | .SH "SEE ALSO" | |
888 | .IX Header "SEE ALSO" | |
889 | Tk::callbacks | |
890 | .SH "KEYWORDS" | |
891 | .IX Header "KEYWORDS" | |
892 | menu, widget |