~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to info/gcl-tk/menu.html

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2014-05-16 17:41:33 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: package-import@ubuntu.com-20140516174133-czs0uktsjj2vkhxk
2.6.11preĀ testĀ 11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<html>
 
3
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
 
4
<head>
 
5
<title>GCL TK Manual: menu</title>
 
6
 
 
7
<meta name="description" content="GCL TK Manual: menu">
 
8
<meta name="keywords" content="GCL TK Manual: menu">
 
9
<meta name="resource-type" content="document">
 
10
<meta name="distribution" content="global">
 
11
<meta name="Generator" content="makeinfo">
 
12
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
13
<link href="index.html#Top" rel="start" title="Top">
 
14
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
 
15
<link href="Widgets.html#Widgets" rel="up" title="Widgets">
 
16
<link href="scrollbar.html#scrollbar" rel="next" title="scrollbar">
 
17
<link href="canvas.html#canvas" rel="prev" title="canvas">
 
18
<style type="text/css">
 
19
<!--
 
20
a.summary-letter {text-decoration: none}
 
21
blockquote.smallquotation {font-size: smaller}
 
22
div.display {margin-left: 3.2em}
 
23
div.example {margin-left: 3.2em}
 
24
div.indentedblock {margin-left: 3.2em}
 
25
div.lisp {margin-left: 3.2em}
 
26
div.smalldisplay {margin-left: 3.2em}
 
27
div.smallexample {margin-left: 3.2em}
 
28
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
 
29
div.smalllisp {margin-left: 3.2em}
 
30
kbd {font-style:oblique}
 
31
pre.display {font-family: inherit}
 
32
pre.format {font-family: inherit}
 
33
pre.menu-comment {font-family: serif}
 
34
pre.menu-preformatted {font-family: serif}
 
35
pre.smalldisplay {font-family: inherit; font-size: smaller}
 
36
pre.smallexample {font-size: smaller}
 
37
pre.smallformat {font-family: inherit; font-size: smaller}
 
38
pre.smalllisp {font-size: smaller}
 
39
span.nocodebreak {white-space:nowrap}
 
40
span.nolinebreak {white-space:nowrap}
 
41
span.roman {font-family:serif; font-weight:normal}
 
42
span.sansserif {font-family:sans-serif; font-weight:normal}
 
43
ul.no-bullet {list-style: none}
 
44
-->
 
45
</style>
 
46
 
 
47
 
 
48
</head>
 
49
 
 
50
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
 
51
<a name="menu"></a>
 
52
<div class="header">
 
53
<p>
 
54
Next: <a href="scrollbar.html#scrollbar" accesskey="n" rel="next">scrollbar</a>, Previous: <a href="canvas.html#canvas" accesskey="p" rel="prev">canvas</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
 
55
</div>
 
56
<hr>
 
57
<a name="menu-1"></a>
 
58
<h3 class="section">2.5 menu</h3>
 
59
 
 
60
<p>menu \- Create and manipulate menu widgets
 
61
</p><a name="Synopsis-4"></a>
 
62
<h4 class="unnumberedsubsec">Synopsis</h4>
 
63
<p><b>menu</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>?
 
64
</p><a name="Standard-Options-4"></a>
 
65
<h4 class="unnumberedsubsec">Standard Options</h4>
 
66
 
 
67
 
 
68
<div class="example">
 
69
<pre class="example">activeBackground       background       disabledForeground      
 
70
activeBorderWidth      borderWidth      font                    
 
71
activeForeground       cursor           foreground              
 
72
</pre></div>
 
73
 
 
74
 
 
75
<p>See <a href="options.html#options">options</a>, for more information.
 
76
</p><a name="Arguments-for-Menu"></a>
 
77
<h4 class="unnumberedsubsec">Arguments for Menu</h4>
 
78
 
 
79
 
 
80
<dl compact="compact">
 
81
<dt><code><b>:postcommand</b></code></dt>
 
82
<dd><p align="right">Name=<code>&quot;<b>postCommand</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Command</b>&quot;</code>
 
83
</p><br>
 
84
 
 
85
<p>If this option is specified then it provides a Tcl command to execute
 
86
each time the menu is posted.  The command is invoked by the <b>post</b>
 
87
widget command before posting the menu.
 
88
</p></dd>
 
89
</dl>
 
90
 
 
91
 
 
92
<dl compact="compact">
 
93
<dt><code><b>:selector</b></code></dt>
 
94
<dd><p align="right">Name=<code>&quot;<b>selector</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Foreground</b>&quot;</code>
 
95
</p><br>
 
96
 
 
97
<p>For menu entries that are check buttons or radio buttons, this option
 
98
specifies the color to display in the selector when the check button
 
99
or radio button is selected.
 
100
</p></dd>
 
101
</dl>
 
102
 
 
103
<a name="Introduction-3"></a>
 
104
<h4 class="unnumberedsubsec">Introduction</h4>
 
105
 
 
106
<p>The <b>menu</b> command creates a new top-level window (given
 
107
by the <i>pathName</i> argument) and makes it into a menu widget.
 
108
Additional
 
109
options, described above, may be specified on the command line
 
110
or in the option database
 
111
to configure aspects of the menu such as its colors and font.
 
112
The <b>menu</b> command returns its
 
113
<i>pathName</i> argument.  At the time this command is invoked,
 
114
there must not exist a window named <i>pathName</i>, but
 
115
<i>pathName</i>&rsquo;s parent must exist.
 
116
</p>
 
117
<p>A menu is a widget that displays a collection of one-line entries arranged
 
118
in a column.  There exist several different types of entries,
 
119
each with different properties.  Entries of different types may be
 
120
combined in a single menu.  Menu entries are not the same as
 
121
entry widgets.  In fact, menu entries are not even distinct widgets;
 
122
the entire menu is one widget.
 
123
</p>
 
124
<p>Menu entries are displayed with up to three
 
125
separate fields.  The main field is a label in the form of text or
 
126
a bitmap, which is determined by the <b>:label</b><span class="roman"> or </span><b>:bitmap</b>
 
127
option for the entry.
 
128
If the  <b>:accelerator</b> option is specified for an entry then a second
 
129
textual field is displayed to the right of the label.  The accelerator
 
130
typically describes a keystroke sequence that may be typed in the
 
131
application to cause the same result as invoking the menu entry.
 
132
The third field is a <i>selector</i>.  The selector is present only for
 
133
check-button or radio-button entries.  It indicates whether the entry
 
134
is selected or not, and is displayed to the left of the entry&rsquo;s
 
135
string.
 
136
</p>
 
137
<p>In normal use, an entry becomes active (displays itself differently)
 
138
whenever the mouse pointer is over the entry.  If a mouse
 
139
button is released over the entry then the entry is <i>invoked</i>.
 
140
The effect of invocation is different for each type of entry;
 
141
these effects are described below in the sections on individual
 
142
entries.
 
143
</p>
 
144
<p>Entries may be <i>disabled</i>, which causes their labels
 
145
and accelerators to be displayed
 
146
with dimmer colors.  A disabled entry cannot be activated or invoked.
 
147
Disabled entries may be re-enabled, at which point it becomes
 
148
possible to activate and invoke them again.
 
149
</p>
 
150
<a name="Command-Entries"></a>
 
151
<h4 class="unnumberedsubsec">Command Entries</h4>
 
152
 
 
153
<p>The most common kind of menu entry is a command entry, which
 
154
behaves much like a button widget.  When a command entry is
 
155
invoked, a Tcl command is executed.  The Tcl
 
156
command is specified with the <b>:command</b> option.
 
157
</p>
 
158
<a name="Separator-Entries"></a>
 
159
<h4 class="unnumberedsubsec">Separator Entries</h4>
 
160
 
 
161
<p>A separator is an entry that is displayed as a horizontal dividing
 
162
line.  A separator may not be activated or invoked, and it has
 
163
no behavior other than its display appearance.
 
164
</p>
 
165
<a name="Check_002dButton-Entries"></a>
 
166
<h4 class="unnumberedsubsec">Check-Button Entries</h4>
 
167
 
 
168
<p>A check-button menu entry behaves much like a check-button widget.
 
169
When it is invoked it toggles back and forth between the selected
 
170
and deselected states.  When the entry is selected, a particular
 
171
value is stored in a particular global variable (as determined by
 
172
the <b>:onvalue</b><span class="roman"> and </span><b>:variable</b> options for the entry);  when
 
173
the entry is deselected another value (determined by the
 
174
<b>:offvalue</b> option) is stored in the global variable.
 
175
A selector box is displayed to the left of the label in a check-button
 
176
entry.  If the entry is selected then the box&rsquo;s center is displayed
 
177
in the color given by the <b>selector</b> option for the menu;
 
178
otherwise the box&rsquo;s center is displayed in the background color for
 
179
the menu.  If a <b>:command</b> option is specified for a check-button
 
180
entry, then its value is evaluated as a Tcl command each time the entry
 
181
is invoked;  this happens after toggling the entry&rsquo;s
 
182
selected state.
 
183
</p>
 
184
<a name="Radio_002dButton-Entries"></a>
 
185
<h4 class="unnumberedsubsec">Radio-Button Entries</h4>
 
186
 
 
187
<p>A radio-button menu entry behaves much like a radio-button widget.
 
188
Radio-button entries are organized in groups of which only one
 
189
entry may be selected at a time.  Whenever a particular entry
 
190
becomes selected it stores a particular value into a particular
 
191
global variable (as determined by the <b>:value</b> and
 
192
<b>:variable</b> options for the entry).  This action
 
193
causes any previously-selected entry in the same group
 
194
to deselect itself.
 
195
Once an entry has become selected, any change to the entry&rsquo;s
 
196
associated variable will cause the entry to deselect itself.
 
197
Grouping of radio-button entries is determined by their
 
198
associated variables:  if two entries have the same associated
 
199
variable then they are in the same group.
 
200
A selector diamond is displayed to the left of the label in each
 
201
radio-button entry.  If the entry is selected then the diamond&rsquo;s
 
202
center is displayed in the color given by the <b>selector</b> option
 
203
for the menu;
 
204
otherwise the diamond&rsquo;s center is displayed in the background color for
 
205
the menu.  If a <b>:command</b> option is specified for a radio-button
 
206
entry, then its value is evaluated as a Tcl command each time the entry
 
207
is invoked;  this happens after selecting the entry.
 
208
</p>
 
209
<a name="Cascade-Entries"></a>
 
210
<h4 class="unnumberedsubsec">Cascade Entries</h4>
 
211
 
 
212
<p>A cascade entry is one with an associated menu (determined
 
213
by the <b>:menu</b> option).  Cascade entries allow the construction
 
214
of cascading menus.  When the entry is activated, the
 
215
associated menu is posted just to the right of the entry;
 
216
that menu remains posted until the higher-level menu is unposted or
 
217
until some other entry is activated in the higher-level menu.
 
218
The associated menu should normally be a child of the menu containing
 
219
the cascade entry, in order for menu traversal to work correctly.
 
220
</p>
 
221
<p>A cascade entry posts its associated menu by invoking a
 
222
Tcl command of the form
 
223
</p>
 
224
<dl compact="compact">
 
225
<dt><i>menu</i><b> :post </b><i>x y</i></dt>
 
226
<dd>
 
227
 
 
228
 
 
229
<p>where <i>menu</i><span class="roman"> is the path name of the associated menu, </span><i>x</i>
 
230
and <i>y</i> are the root-window coordinates of the upper-right
 
231
corner of the cascade entry, and <i>group</i> is the name of the
 
232
menu&rsquo;s group (as determined in its last <b>post</b> widget command).
 
233
The lower-level menu is unposted by executing a Tcl command with
 
234
the form
 
235
</p>
 
236
</dd>
 
237
<dt><i>menu</i><b>:unpost</b></dt>
 
238
<dd><p>where <i>menu</i> is the name of the associated menu.
 
239
</p></dd>
 
240
</dl>
 
241
 
 
242
<p>If a <b>:command</b> option is specified for a cascade entry then it is
 
243
evaluated as a Tcl command each time the associated menu is posted (the
 
244
evaluation occurs before the menu is posted).
 
245
</p>
 
246
<a name="A-Menu-Widget_0027s-Arguments"></a>
 
247
<h4 class="unnumberedsubsec">A Menu Widget&rsquo;s Arguments</h4>
 
248
 
 
249
<p>The <b>menu</b> command creates a new Tcl command whose
 
250
name is <i>pathName</i>.  This
 
251
command may be used to invoke various
 
252
operations on the widget.  It has the following general form:
 
253
</p>
 
254
<dl compact="compact">
 
255
<dt><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?</dt>
 
256
<dd><p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
 
257
determine the exact behavior of the command.
 
258
</p></dd>
 
259
</dl>
 
260
 
 
261
<p>Many of the widget commands for a menu take as one argument an
 
262
indicator of which entry of the menu to operate on.  These
 
263
indicators are called <i>index</i>es and may be specified in
 
264
any of the following forms:
 
265
</p>
 
266
<dl compact="compact">
 
267
<dt><i>number</i></dt>
 
268
<dd><p>Specifies the entry numerically, where 0 corresponds
 
269
to the top-most entry of the menu, 1 to the entry below it, and
 
270
so on.
 
271
</p></dd>
 
272
<dt><b>active</b></dt>
 
273
<dd><p>Indicates the entry that is currently active.  If no entry is
 
274
active then this form is equivalent to <b>none</b>.  This form may
 
275
not be abbreviated.
 
276
</p></dd>
 
277
<dt><b>last</b></dt>
 
278
<dd><p>Indicates the bottommost entry in the menu.  If there are no
 
279
entries in the menu then this form is equivalent to <b>none</b>.
 
280
This form may not be abbreviated.
 
281
</p></dd>
 
282
<dt><b>none</b></dt>
 
283
<dd><p>Indicates &ldquo;no entry at all&rdquo;;  this is used most commonly with
 
284
the <b>activate</b> option to deactivate all the entries in the
 
285
menu.  In most cases the specification of <b>none</b> causes
 
286
nothing to happen in the widget command.
 
287
This form may not be abbreviated.
 
288
</p></dd>
 
289
<dt><b>@</b><i>number</i></dt>
 
290
<dd><p>In this form, <i>number</i> is treated as a y-coordinate in the
 
291
menu&rsquo;s window;  the entry spanning that y-coordinate is used.
 
292
For example, &ldquo;<b>@0</b>&rdquo; indicates the top-most entry in the
 
293
window.  If <i>number</i> is outside the range of the window
 
294
then this form is equivalent to <b>none</b>.
 
295
</p></dd>
 
296
<dt><i>pattern</i></dt>
 
297
<dd><p>If the index doesn&rsquo;t satisfy one of the above forms then this
 
298
form is used.  <i>Pattern</i> is pattern-matched against the label of
 
299
each entry in the menu, in order from the top down, until a
 
300
matching entry is found.  The rules of <b>Tcl_StringMatch</b>
 
301
are used.
 
302
</p>
 
303
<p>The following widget commands are possible for menu widgets:
 
304
</p></dd>
 
305
<dt><i>pathName </i><b>:activate </b><i>index</i></dt>
 
306
<dd><p>Change the state of the entry indicated by <i>index</i><span class="roman"> to </span><b>active</b>
 
307
and redisplay it using its active colors.
 
308
Any previously-active entry is deactivated.  If <i>index</i>
 
309
is specified as <b>none</b>, or if the specified entry is
 
310
disabled, then the menu ends up with no active entry.
 
311
Returns an empty string.
 
312
</p></dd>
 
313
<dt><i>pathName </i><b>:add </b><i>type </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
 
314
<dd><p>Add a new entry to the bottom of the menu.  The new entry&rsquo;s type
 
315
is given by <i>type</i><span class="roman"> and must be one of </span><b>cascade</b>,
 
316
<b>checkbutton</b><span class="roman">, </span><b>command</b><span class="roman">, </span><b>radiobutton</b><span class="roman">, or </span><b>separator</b>,
 
317
or a unique abbreviation of one of the above.  If additional arguments
 
318
are present, they specify any of the following options:
 
319
</p>
 
320
<dl compact="compact">
 
321
<dt><b>:activebackground </b><i>value</i></dt>
 
322
<dd><p>Specifies a background color to use for displaying this entry when it
 
323
is active.
 
324
If this option is specified as an empty string (the default), then the
 
325
<b>activeBackground</b> option for the overall menu is used.
 
326
This option is not available for separator entries.
 
327
</p></dd>
 
328
<dt><b>:accelerator </b><i>value</i></dt>
 
329
<dd><p>Specifies a string to display at the right side of the menu entry.
 
330
Normally describes an accelerator keystroke sequence that may be
 
331
typed to invoke the same function as the menu entry.  This option
 
332
is not available for separator entries.
 
333
</p></dd>
 
334
<dt><b>:background </b><i>value</i></dt>
 
335
<dd><p>Specifies a background color to use for displaying this entry when it
 
336
is in the normal state (neither active nor disabled).
 
337
If this option is specified as an empty string (the default), then the
 
338
<b>background</b> option for the overall menu is used.
 
339
This option is not available for separator entries.
 
340
</p></dd>
 
341
<dt><b>:bitmap </b><i>value</i></dt>
 
342
<dd><p>Specifies a bitmap to display in the menu instead of a textual
 
343
label, in any of the forms accepted by <b>Tk_GetBitmap</b>.
 
344
This option overrides the <b>:label</b> option but may be reset
 
345
to an empty string to enable a textual label to be displayed.
 
346
This option is not available for separator entries.
 
347
</p></dd>
 
348
<dt><b>:command </b><i>value</i></dt>
 
349
<dd><p>For command, checkbutton, and radiobutton entries, specifies a
 
350
Tcl command to execute when the menu entry is invoked.
 
351
For cascade entries, specifies a Tcl command to execute
 
352
when the entry is activated (i.e. just before its submenu is
 
353
posted).
 
354
Not available for separator entries.
 
355
</p></dd>
 
356
<dt><b>:font </b><i>value</i></dt>
 
357
<dd><p>Specifies the font to use when drawing the label or accelerator
 
358
string in this entry.
 
359
If this option is specified as an empty string (the default) then
 
360
the <b>font</b> option for the overall menu is used.
 
361
This option is not available for separator entries.
 
362
</p></dd>
 
363
<dt><b>:label </b><i>value</i></dt>
 
364
<dd><p>Specifies a string to display as an identifying label in the menu
 
365
entry.  Not available for separator entries.
 
366
</p></dd>
 
367
<dt><b>:menu </b><i>value</i></dt>
 
368
<dd><p>Available only for cascade entries.  Specifies the path name of
 
369
the menu associated with this entry.
 
370
</p></dd>
 
371
<dt><b>:offvalue </b><i>value</i></dt>
 
372
<dd><p>Available only for check-button entries.  Specifies the value to
 
373
store in the entry&rsquo;s associated variable when the entry is
 
374
deselected.
 
375
</p></dd>
 
376
<dt><b>:onvalue </b><i>value</i></dt>
 
377
<dd><p>Available only for check-button entries.  Specifies the value to
 
378
store in the entry&rsquo;s associated variable when the entry is selected.
 
379
</p></dd>
 
380
<dt><b>:state </b><i>value</i></dt>
 
381
<dd><p>Specifies one of three states for the entry:  <b>normal</b><span class="roman">, </span><b>active</b>,
 
382
or <b>disabled</b>.  In normal state the entry is displayed using the
 
383
<b>foreground</b><span class="roman"> option for the menu and the </span><b>background</b>
 
384
option from the entry or the menu.
 
385
The active state is typically used when the pointer is over the entry.
 
386
In active state the entry is displayed using the <b>activeForeground</b>
 
387
option for the menu along with the <b>activebackground</b> option from
 
388
the entry.
 
389
Disabled state means that the entry is insensitive:  it doesn&rsquo;t activate
 
390
and doesn&rsquo;t respond to mouse button presses or releases.
 
391
In this state the entry is displayed according to the 
 
392
<b>disabledForeground</b> option for the menu and the
 
393
<b>background</b> option from the entry.
 
394
This option is not available for separator entries.
 
395
</p></dd>
 
396
<dt><b>:underline </b><i>value</i></dt>
 
397
<dd><p>Specifies the integer index of a character to underline in the entry.
 
398
This option is typically used to indicate keyboard traversal characters.
 
399
0 corresponds to the first character of the text displayed in the entry,
 
400
1 to the next character, and so on.
 
401
If a bitmap is displayed in the entry then this option is ignored.
 
402
This option is not available for separator entries.
 
403
</p></dd>
 
404
<dt><b>:value </b><i>value</i></dt>
 
405
<dd><p>Available only for radio-button entries.  Specifies the value to
 
406
store in the entry&rsquo;s associated variable when the entry is selected.
 
407
</p></dd>
 
408
<dt><b>:variable </b><i>value</i></dt>
 
409
<dd><p>Available only for check-button and radio-button entries.  Specifies
 
410
the name of a global value to set when the entry is selected.
 
411
For check-button entries the variable is also set when the entry
 
412
is deselected.  For radio-button entries, changing the variable
 
413
causes the currently-selected entry to deselect itself.
 
414
</p></dd>
 
415
</dl>
 
416
</dd>
 
417
</dl>
 
418
 
 
419
<p>The <b>add</b> widget command returns an empty string.
 
420
</p>
 
421
 
 
422
<dl compact="compact">
 
423
<dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt>
 
424
<dd><p>Query or modify the configuration options of the widget.
 
425
If no <i>option</i> is specified, returns a list describing all of
 
426
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
 
427
information on the format of this list).  If <i>option</i> is specified
 
428
with no <i>value</i>, then the command returns a list describing the
 
429
one named option (this list will be identical to the corresponding
 
430
sublist of the value returned if no <i>option</i> is specified).  If
 
431
one or more <i>option:value</i> pairs are specified, then the command
 
432
modifies the given widget option(s) to have the given value(s);  in
 
433
this case the command returns an empty string.
 
434
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>menu</b>
 
435
command.
 
436
</p></dd>
 
437
<dt><i>pathName </i><b>:delete </b><i>index1</i><span class="roman"> ?</span><i>index2</i>?</dt>
 
438
<dd><p>Delete all of the menu entries between <i>index1</i> and
 
439
<i>index2</i> inclusive.
 
440
If <i>index2</i><span class="roman"> is omitted then it defaults to </span><i>index1</i>.
 
441
Returns an empty string.
 
442
</p></dd>
 
443
<dt><i>pathName </i><b>:disable </b><i>index</i></dt>
 
444
<dd><p>Change the state of the entry given by <i>index</i><span class="roman"> to </span><b>disabled</b>
 
445
and redisplay the entry using its disabled colors.
 
446
Returns an empty string.
 
447
This command is obsolete and will eventually be removed;
 
448
use &ldquo;<i>pathName </i><b>:entryconfigure </b><i>index</i><span class="roman"> :state disabled</span>&rdquo; instead.
 
449
</p></dd>
 
450
<dt><i>pathName </i><b>:enable </b><i>index</i></dt>
 
451
<dd><p>Change the state of the entry given by <i>index</i><span class="roman"> to </span><b>normal</b>
 
452
and redisplay the entry using its normal colors.
 
453
Returns an empty string.
 
454
This command is obsolete and will eventually be removed;
 
455
use &ldquo;<i>pathName </i><b>:entryconfigure </b><i>index</i><span class="roman"> :state normal</span>&rdquo; instead.
 
456
</p></dd>
 
457
<dt><i>pathName </i><b>:entryconfigure </b><i>index</i><span class="roman"> </span><span class="roman">?</span><i>options</i>?</dt>
 
458
<dd><p>This command is similar to the <b>configure</b> command, except that
 
459
it applies to the options for an individual entry, whereas <b>configure</b>
 
460
applies to the options for the menu as a whole.
 
461
<i>Options</i><span class="roman"> may have any of the values accepted by the </span><b>add</b>
 
462
widget command.  If <i>options</i> are specified, options are modified
 
463
as indicated
 
464
in the command and the command returns an empty string.
 
465
If no <i>options</i> are specified, returns a list describing
 
466
the current options for entry <i>index</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
 
467
information on the format of this list).
 
468
</p></dd>
 
469
<dt><i>pathName </i><b>:index </b><i>index</i></dt>
 
470
<dd><p>Returns the numerical index corresponding to <i>index</i>, or
 
471
<b>none</b><span class="roman"> if </span><i>index</i><span class="roman"> was specified as </span><b>none</b>.
 
472
</p></dd>
 
473
<dt><i>pathName </i><b>:invoke </b><i>index</i></dt>
 
474
<dd><p>Invoke the action of the menu entry.  See the sections on the
 
475
individual entries above for details on what happens.  If the
 
476
menu entry is disabled then nothing happens.  If the
 
477
entry has a command associated with it then the result of that
 
478
command is returned as the result of the <b>invoke</b> widget
 
479
command.  Otherwise the result is an empty string.  Note:  invoking
 
480
a menu entry does not automatically unpost the menu.  Normally
 
481
the associated menubutton will take care of unposting the menu.
 
482
</p></dd>
 
483
<dt><i>pathName </i><b>:post </b><i>x y</i></dt>
 
484
<dd><p>Arrange for the menu to be displayed on the screen at the root-window
 
485
coordinates given by <i>x</i><span class="roman"> and </span><i>y</i>.  These coordinates are
 
486
adjusted if necessary to guarantee that the entire menu is visible on
 
487
the screen.  This command normally returns an empty string.
 
488
If the <b>:postcommand</b> option has been specified, then its value is
 
489
executed as a Tcl script before posting the menu and the result of
 
490
that script is returned as the result of the <b>post</b> widget
 
491
command.
 
492
If an error returns while executing the command, then the error is
 
493
returned without posting the menu.
 
494
</p></dd>
 
495
<dt><i>pathName </i><b>:unpost</b></dt>
 
496
<dd><p>Unmap the window so that it is no longer displayed.  If a
 
497
lower-level cascaded menu is posted, unpost that menu.  Returns an
 
498
empty string.
 
499
</p></dd>
 
500
<dt><i>pathName </i><b>:yposition </b><i>index</i></dt>
 
501
<dd><p>Returns a decimal string giving the y-coordinate within the menu
 
502
window of the topmost pixel in the entry specified by <i>index</i>.
 
503
</p>
 
504
 
 
505
</dd>
 
506
</dl>
 
507
<a name="Default-Bindings"></a>
 
508
<h4 class="unnumberedsubsec">Default Bindings</h4>
 
509
 
 
510
 
 
511
<p>Tk automatically creates class bindings for menus that give them
 
512
the following default behavior:
 
513
</p><ul class="no-bullet">
 
514
<li> [1]
 
515
When the mouse cursor enters a menu, the entry underneath the mouse
 
516
cursor is activated;  as the mouse moves around the menu, the active
 
517
entry changes to track the mouse.
 
518
</li><li> [2]
 
519
When button 1 is released over a menu, the active entry (if any) is invoked.
 
520
</li><li> [3]
 
521
A menu can be repositioned on the screen by dragging it with mouse
 
522
button 2.
 
523
</li><li> [4]
 
524
A number of other bindings are created to support keyboard menu traversal.
 
525
See the manual entry for <b>tk_bindForTraversal</b> for details on these
 
526
bindings.
 
527
</li></ul>
 
528
 
 
529
<p>Disabled menu entries are non-responsive:  they don&rsquo;t activate and
 
530
ignore mouse button presses and releases.
 
531
</p>
 
532
<p>The behavior of menus can be changed by defining new bindings for
 
533
individual widgets or by redefining the class bindings.
 
534
</p>
 
535
<a name="Bugs"></a>
 
536
<h4 class="unnumberedsubsec">Bugs</h4>
 
537
 
 
538
<p>At present it isn&rsquo;t possible to use the
 
539
option database to specify values for the options to individual
 
540
entries.
 
541
</p>
 
542
<a name="Keywords-4"></a>
 
543
<h4 class="unnumberedsubsec">Keywords</h4>
 
544
<p>menu, widget
 
545
</p><hr>
 
546
<div class="header">
 
547
<p>
 
548
Next: <a href="scrollbar.html#scrollbar" accesskey="n" rel="next">scrollbar</a>, Previous: <a href="canvas.html#canvas" accesskey="p" rel="prev">canvas</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
 
549
</div>
 
550
 
 
551
 
 
552
 
 
553
</body>
 
554
</html>