1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
|
<!-- manual page source format generated by RosettaMan v2.5a6, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>man page(1) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="#toc">Table of Contents</A><P>
_________________________________________________________________
<P>
<H2><A NAME="sect1" HREF="#toc1"><B>NAME</B></A></H2>
menubar - Create and manipulate menubar menu widgets
<P>
<H2><A NAME="sect2" HREF="#toc2"><B>SYNOPSIS</B></A></H2>
<B>menubar</B> <I>pathName</I> ?<I>options</I>?
<P>
<H2><A NAME="sect3" HREF="#toc3"><B>INHERITANCE</B></A></H2>
itk::Widget <- menubar
<P>
<H2><A NAME="sect4" HREF="#toc4"><B>STANDARD</B> <B>OPTIONS</B></A></H2>
<DL>
<DT><B>activeBackground</B> <DD> <B>borderWidth</B> <B>highlightBackgroundpadY</B>
</DD>
</DL>
<DL>
<DT><B>activeBorderWidth</B> <DD> <B>cursor</B> <B>highligthThicknessrelief</B>
</DD>
</DL>
<DL>
<DT><B>activeForeground</B> <DD> <B>disabledForegroundhighlightColorwrapLength</B>
<B>anchor</B> <B>font</B> <B>justify</B>
<B>background</B> <B>foreground</B> <B>padX</B>
<P>
</DD>
</DL>
See the "options" manual entry for details on the standard
options.
<P>
<H2><A NAME="sect5" HREF="#toc5"><B>WIDGET-SPECIFIC</B> <B>OPTIONS</B></A></H2>
<DL>
<DT>Name: <DD> <B>helpVariable</B>
</DD>
</DL>
<DL>
<DT>Class: <DD> <B>HelpVariable</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD> <B>-helpvariable</B>
<P>
</DD>
</DL>
Specifies the global variable to update whenever the
mouse is in motion over a menu entry. This global variable
is updated with the current value of the active
menu entry's <B>helpStr</B>. Other widgets can "watch" this
variable with the trace command, or as is the case with
entry or label widgets, they can set their <B>textVariable</B>
to the same global variable. This allows for a simple
implementation of a help status bar. Whenever the mouse
leaves a menu entry, the helpVariable is set to the
empty string {}. The <A HREF="http://localhost/cgi-bin/man2html?mainwindow?1">mainwindow(1)</A> associates its
helpstatus and its menubar in this fashion.
<P>
<DL>
<DT>Name: <DD> <B>menuButtons</B>
</DD>
</DL>
<DL>
<DT>Class: <DD> <B>MenuButtons</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD> <B>-menubuttons</B>
<P>
</DD>
</DL>
The menuButton option is a string which specifies the
arrangement of menubuttons on the menubar frame. Each
menubutton entry is delimited by the newline character.
<P>
menubar .mb -menubuttons {<BR>
menubutton file -text File<BR>
menubutton edit -text Edit<BR>
menubutton options -text Options
}
specifies that three menubuttons will be added to the
menubar (file, edit, options). Each entry is translated
into an add command call.
<P>
The <B>menuButtons</B> option can accept embedded variables,
commands, and backslash quoting. Embedded variables and
commands must be enclosed in curly braces ({}) to
ensure proper parsing of the substituted values.
_________________________________________________________________
<P>
<H2><A NAME="sect6" HREF="#toc6"><B>DESCRIPTION</B></A></H2>
The <B>menubar</B> command creates a new window (given by the <I>path_Name</I>
argument) and makes it into a <B>menubar</B> menu widget.
Additional options, described above may be specified on the
command line or in the option database to configure aspects
of the menubar such as its colors and font. The <B>menubar</B> command
returns its <I>pathName</I> argument. At the time this command
is invoked, there must not exist a window named pathName,
but pathName's parent must exist.
<P>
A <B>menubar</B> is a widget that simplifies the task of creating
menu hierarchies. It encapsulates a <B>frame</B> widget, as well as
<B>menubuttons</B>, <B>menus</B>, and menu <B>entries</B>. The menubar allows
menus to be specified and referenced in a more consistent
manner than using Tk to build menus directly.
<P>
<B>Menubar</B> allows a menu tree to be expressed in a hierachical
"language". The <B>menubar</B> accepts a <B>menuButtons</B> option that
allows a list of menubuttons to be added to the menubar. In
turn, each menubutton accepts a <B>menu</B> option that specifies a
list of menu entries to be added to the menubutton's menu.
Cascade entries also accept the <B>menu</B> option for specifying a
list of menu entries to be added to the cascade's menu.
<P>
Additionally, the menubar allows each component of the menubar
system to be referenced by a simple <I>menuPathName</I> syntax.
The menubar also extends the set of options for menu entries
to include a <B>helpStr</B> option.
<P>
<H2><A NAME="sect7" HREF="#toc7"><B>MENU</B> <B>PATH</B> <B>NAMES</B></A></H2>
A <I>menuPathName</I> is a series of component names separated by
the `.' character. Each menubar component can be referenced
via these <I>menuPathNames</I>. <I>menuPathNames</I> are similar to widget
pathNames in Tk. Some correspond directly to a widget pathName
(components of type <B>menu</B> or <B>menubutton</B>), others
correspond to a menu entry type. Every widget and entry in a
menubar can be referenced with the <I>menuPathName</I> naming convention.
A menubar can have four types of components:
<P>
<B>frame</B>. A menubar holds exactly one frame which manages
menubuttons. The frame is always signified by the `.'
character as the path name.
<B>menubutton</B>. A menubutton corresponds directly to a Tk
menubutton. See <A HREF="http://localhost/cgi-bin/man2html?menubutton?n">menubutton(n)</A>.
<P>
<B>menu</B>. A menu is attached to a menubutton and
corresponds directly to Tk's menu widget. A menu is
always signified by the <I>menuPathName</I> ending with the
keyword <B>menu</B>. See <A HREF="http://localhost/cgi-bin/man2html?menu?n">menu(n)</A>.
<P>
<B>entry</B>. An entry corresponds directly to Tk's menu
widget entries. Menus consist of a column of one line
entries. Entries may be of type: <B>command</B>, <B>checkbutton</B>,
<B>radiobutton</B>, <B>separator</B>, or <B>cascade</B>. For a complete
description of these types see the discussion on
<B>ENTRIES</B> in <A HREF="http://localhost/cgi-bin/man2html?menu?n">menu(n)</A>.
<P>
The suffix of a <I>menuPathName</I> may have the form of:
<P>
<I>tkWidgetName</I> Specifies the name of the component, either a
<B>frame</B>, <B>menubutton</B>, <B>menu</B>, or an <B>entry</B>. This is
the normal naming of widgets. For example,
.file references a <B>menubutton</B> named <I>file</I>.
<P>
The <I>menuPathName</I> is a series of segment names, each
separated by the `.' character. Segment names may be one of
the following forms:
<P>
<DL>
<DT><I>number</I> <DD> Specifies the index of the the component. For
menubuttons, 0 corresponds to the left-most
menubutton of the menu bar frame. As an example,
.<I>1</I> would correspond to the second menubutton
on the menu bar frame.
<P>
</DD>
</DL>
For entries, 0 corresponds to the top-most
entry of the menu. For example, .file.0 would
correspond to the first entry on the menu
attached to the menubutton named <I>file</I>.
<P>
<DL>
<DT><B>end</B> <DD> Specifes the last component. For menubuttons,
it specifies the right-most entry of the menu
bar frame. For menu entries, it specifies the
bottom-most entry of the menu.
<P>
</DD>
</DL>
<DL>
<DT><B>last</B> <DD> Same as end.
<P>
</DD>
</DL>
Finally, menu components always end with the <B>menu</B> keyword.
These components are automatically created via the -menu
option on menubuttons and cascades or via the <B>add</B> or <B>insert</B>
commands.
<P>
<DL>
<DT><B>menu</B> <DD> Specifes the menu pane that is associated with
the given menubutton prefix. For example,
.<I>file</I>.<I>menu</I> specifies the menu pane attached to
the
<P>
</DD>
</DL>
For example, the path .<I>file</I>.<I>new</I> specifies the entry named
new on the menu associated with the file menubutton located
on the menu bar. The path .<I>file</I>.<I>menu</I> specifies the menu pane
associated with the menubutton .<I>file</I>. The path .<I>last</I> specifies
the last menu on the menu bar. The path .<I>0</I>.<I>last</I> would
specify the first menu (file) and the last entry on that
menu (quit), yielding .<I>file</I>.<I>quit</I>.
<P>
As a restriction, the last name segment of <I>menuPathName</I> cannot
be one of the keywords last, menu, end, nor may it be a
numeric value (integer).
<P>
<H2><A NAME="sect8" HREF="#toc8"><B>WIDGET-SPECIFIC</B> <B>METHODS</B></A></H2>
The <B>menubar</B> command creates a new Tcl command whose name is
<I>pathName</I>. This command may be used to invoke various operations
on the widget. It has the following general form:
<P>
<I>pathName</I> <I>option</I> ?<I>arg</I> <I>arg</I> ...?
<P>
<I>option</I> and the <I>arg</I>s determine the exact behavior of the command.
<P>
In addition, many of the widget commands for menubar take as
one argument a path name to a menu component. These path
names are called <I>menuPathName</I>s. See the discussion on <B>MENUBAR</B>
<B>PATH</B> <B>NAMES</B> above.
<P>
The following commands are possible for menubar widgets:
<P>
<I>pathName</I> <B>add</B> <I>type</I> <I>menuPathName</I> ?<I>option</I> <I>value</I> <I>option</I> <I>value</I>?
Adds either a menu to the menu bar or a menu entry to a
menu pane.
<P>
If additional arguments are present, they specify
<I>option</I>s available to component type <B>entry</B>. See the man
pages for <A HREF="http://localhost/cgi-bin/man2html?menu?1">menu(1)</A> in the section on <B>ENTRIES</B>.
<P>
If <I>type</I> is one of <B>cascade</B>, <B>checkbutton</B>, <B>command</B>,
<B>radiobutton</B>, or <B>separator</B> it adds a new entry to the
bottom of the menu denoted by the prefix of <I>menuPath_Name</I>.
If additonal arguments are present, they specify
options available to menu <B>entry</B> widgets. In addition,
the <B>helpStr</B> option is added by the menubar widget to
all components of type entry.
<P>
<DL>
<DT><B>-helpstr</B> <I>value</I><DD>
Specifes the string to associate with the entry.
When the mouse moves over the associated entry,
the variable denoted by <B>helpVariable</B> is set.
Another widget can bind to the helpVariable and
thus display status help.
<P>
</DD>
</DL>
If the type of the component added is <B>menubutton</B> or
<B>cascade</B>, a menubutton or cascade is added to the menubar.
If additional arguments are present, they specify
options available to menubutton or cascade widgets. In
addition, the <B>menu</B> option is added by the menubar
widget to all menubutton and cascade widgets.
<P>
<DL>
<DT><B>-menu</B> <I>menuSpec</I><DD>
This is only valid for <I>menuPathName</I>s of type <B>menubutton</B>
or <B>cascade</B>. Specifes an option set and/or a
set of entries to place on a menu and associate
with the menubutton or cascade. The <B>option</B> keyword
allows the menu widget to be configured. Each item
in the <I>menuSpec</I> is treated as add commands (each
with the possibility of having other -menu
options). In this way a menu can be recursively
built.
<P>
</DD>
</DL>
The last segment of <I>menuPathName</I> cannot be one of
the keywords <B>last</B>, <B>menu</B>, <B>end</B>. Additionally, it may
not be a <I>number</I>. However the <I>menuPathName</I> may be
referenced in this manner (see discussion of <B>COMPONENT</B>
<B>PATH</B> <B>NAMES</B>).
<P>
Note that the same curly brace quoting rules apply
to <B>-menu</B> option strings as did to <B>-menubuttons</B>
option strings. See the earlier discussion on
<B>umenubuttons</B> in the "<B>WIDGET-SPECIFIC</B> <B>OPTIONS</B>" section.
<P>
<I>pathName</I> <B>cget</B> <I>option</I><BR>
Returns the current value of the configuration option
given by <I>option</I>.
<P>
<I>pathName</I> <B>configure</B> ?<I>options</I> <I>value</I> <I>option</I> <I>value</I>?
Query or modify the configuration options of the
widget. If no <I>option</I> is specified, returns a list
describing all of the available options for <B>pathName</B>
(see <B>Tk_ConfigureInfo</B> for information on the format of
this list). If <I>option</I> is specified with no value, then
the command returns a list describing the one named
option (this list will be identical to the corresponding
sublist of the value returned if no option is
specified). If one or more option-value pairs are
specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the
command returns an empty string.
<P>
<I>pathName</I> <B>delete</B> <I>menuPathName</I> ?<I>menuPathName2</I>?
If <I>menuPathName</I> is of component type <B>Menubutton</B> or
<P>
<B>Menu</B>, delete operates on menus. If <I>menuPathName</I> is of
component type <B>Entry</B>, delete operates on menu entries.
<P>
This command deletes all components between <I>menuPath_Name</I>
and <I>menuPathName2</I> inclusive. If <I>menuPathName2</I> is
omitted then it defaults to <I>menuPathName</I>. Returns an
empty string.
<P>
If <I>menuPathName</I> is of type menubar, then all menus and
the menu bar frame will be destroyed. In this case
<I>menuPathName2</I> is ignored.
<P>
<I>pathName</I> <B>index</B> <I>menuPathName</I><BR>
If <I>menuPathName</I> is of type menubutton or menu, it
returns the position of the menu/menubutton on the
menubar frame.
<P>
If <I>menuPathName</I> is of type <B>command</B>, <B>separator</B>,
<B>radiobutton</B>, <B>checkbutton</B>, or <B>cascade</B>, it returns the
menu widget's numerical index for the entry corresponding
to <I>menuPathName</I>. If path is not found or the path
is equal to ".", a value of -1 is returned.
<P>
<I>pathName</I> <B>insert</B> <I>menuPathName</I> <I>type</I> <I>name</I> ?<I>option</I> <I>value</I>?
Insert a new component named name before the component
specified by <I>menuPathName</I>.
<P>
If <I>menuPathName</I> is of type <B>Menubutton</B> or <B>Menu</B>, the new
component inserted is of type <B>Menu</B> and given the name
name. In this case valid <I>option</I> <I>value</I> pairs are those
accepted by menubuttons.
<P>
If <I>menuPathName</I> is of type <B>Entry</B>, the new component
inserted is of type <B>entry</B> and given the name <I>name</I>. In
this case, valid <I>option</I> <I>value</I> pairs are those accepted
by menu entries. <I>Name</I> cannot be one of the keywords
<B>last</B>, <B>menu</B>, <B>end</B>. Additionally, it may not be a number.
However the <I>menuPathName</I> may be referenced in this
manner (see discussion of <B>COMPONENT</B> <B>PATH</B> <B>NAMES</B>).
<P>
<I>pathName</I> <B>invoke</B> <I>menuPathName</I><BR>
Invoke the action of the menu entry denoted by <I>menu_PathName</I>.
See the sections on the individual entries in
the <A HREF="http://localhost/cgi-bin/man2html?menu?1">menu(1)</A> man pages. If the menu entry is disabled
then nothing happens. If the entry has a command associated
with it then the result of that command is
returned as the result of the <B>invoke</B> widget command.
Otherwise the result is an empty string.
<P>
If <I>menuPathName</I> is not a menu entry, an error is
issued.
<P>
<I>pathName</I> <B>menucget</B> <I>menuPathName</I> <I>option</I><BR>
Returns the current value of the configuration option
given by <I>option</I>. The component type of <I>menuPathName</I>
determines the valid available options.
<P>
<I>pathName</I> <B>menuconfigure</B> <I>menuPathName</I> ?<I>option</I> <I>value</I>?
Query or modify the configuration options of the componet
of the menubar specified by <I>menuPathName</I>. If no
<I>option</I> is specified, returns a list describing all of
the available options for <I>menuPathName</I> (see
<B>Tk_ConfigureInfo</B> for information on the format of this
list). If <I>option</I> is specified with no value, then the
command returns a list describing the one named option
(this list will be identical to the corresponding sublist
of the value returned if no option is specified).
If one or more option-value pairs are specified, then
the command modifies the given widget option(s) to have
the given value(s); in this case the command returns an
empty string. The component type of <I>menuPathName</I> determines
the valid available options.
<P>
<I>pathName</I> <B>path</B> ?<I>mode</I>? <I>pattern</I><BR>
Returns a fully formed <I>menuPathName</I> that matches <I>pat_</I>t<I>ern</I>.
If no match is found it returns -1. The <I>mode</I>
argument indicates how the search is to be matched
against <I>pattern</I> and it must have one of the following
values:
<P>
<DL>
<DT><B>-glob</B><DD>
Pattern is a glob-style pattern which is matched
against each component path using the same rules
as the string match command.
<P>
</DD>
</DL>
<DL>
<DT><B>-regexp</B><DD>
Pattern is treated as a regular expression and
matched against each component of the <I>menuPathName</I>
using the same rules as the regexp command. The
default mode is -glob.
<P>
</DD>
</DL>
<I>pathName</I> <B>type</B> <I>menuPathName</I><BR>
Returns the type of the component specified by <I>menu_PathName</I>.
For menu entries, this is the type argument
passed to the <B>add</B>/<B>insert</B> widget command when the entry
was created, such as <B>command</B> or <B>separator</B>. Othewise it
is either a <B>menubutton</B> or a <B>menu</B>.
<P>
<I>pathName</I> <B>yposition</B> <I>menuPathName</I><BR>
Returns a decimal string giving the y-coordinate within
the menu window of the topmost pixel in the entry
specified by <I>menuPathName</I>. If the <I>menuPathName</I> is not
an entry, an error is issued.
<P>
<H2><A NAME="sect9" HREF="#toc9"><B>EXAMPLE</B> <B>ONE:</B> <B>USING</B> <B>GRAMMAR</B></A></H2>
The following example creates a menubar with "File", "Edit",
"Options" menubuttons. Each of these menubuttons has an
associated menu. In turn the File menu has menu entries, as
well as the Edit menu and the Options menu. The Options menu
is a tearoff menu with selectColor (for radiobuttons) set to
blue. In addition, the Options menu has a cascade titled
More, with several menu entries attached to it as well. An
entry widget is provided to display help status.
<P>
menubar .mb -helpvariable helpVar -menubuttons {
menubutton file -text File -menu {<BR>
options -tearoff false<BR>
command new -label New \<BR>
-helpstr "Open new document" \
-command {puts NEW}<BR>
command close -label Close \<BR>
-helpstr "Close current document" \
-command {puts CLOSE}<BR>
separator sep1<BR>
command exit -label Exit -command {exit} \
-helpstr "Exit application"<BR>
}<BR>
menubutton edit -text Edit -menu {<BR>
options -tearoff false<BR>
command undo -label Undo -underline 0 \
-helpstr "Undo last command" \
-command {puts UNDO}<BR>
separator sep2<BR>
command cut -label Cut -underline 1 \
-helpstr "Cut selection to clipboard" \
-command {puts CUT}<BR>
command copy -label Copy -underline 1 \
-helpstr "Copy selection to clipboard" \
-command {puts COPY}<BR>
command paste -label Paste -underline 0 \
-helpstr "Paste clipboard contents" \
-command {puts PASTE}<BR>
}<BR>
menubutton options -text Options -menu {
options -tearoff false -selectcolor blue
radiobutton byName -variable viewMode \
-value NAME -label "by Name" \
-helpstr "View files by name order" \
-command {puts NAME}<BR>
radiobutton byDate -variable viewMode \
-value DATE -label "by Date" \
-helpstr "View files by date order" \
-command {puts DATE}<BR>
cascade prefs -label Preferences -menu {
command colors -label Colors... \
-helpstr "Change text colors" \
-command {puts COLORS}<BR>
command fonts -label Fonts... \
-helpstr "Change text font" \
-command {puts FONT}<BR>
}<BR>
}
<P>
}
<P>
frame .fr -width 300 -height 300<BR>
entry .ef -textvariable helpVar<BR>
pack .mb -anchor nw -fill x -expand yes
pack .fr -fill both -expand yes<BR>
pack .ef -anchor sw -fill x -expand yes
<P>
<H2><A NAME="sect10" HREF="#toc10"><B>EXAMPLE</B> <B>TWO:</B> <B>USING</B> <B>METHODS</B></A></H2>
Alternatively the same menu could be created by using the
add and configure methods:
<P>
menubar .mb<BR>
.mb configure -menubuttons {<BR>
menubutton file -text File -menu {
command new -label New<BR>
command close -label Close
separator sep1<BR>
<DL>
<DT>command <DD> quit -label Quit
}
menubutton edit -text Edit
}
<P>
</DD>
</DL>
<DL>
<DT>.mb add command .edit.undo -label Undo -underline 0<DD>
.mb add separator .edit.sep2
.mb add command .edit.cut -label Cut -underline 1
.mb add command .edit.copy -label Copy -underline 1
.mb add command .edit.paste -label Paste -underline 0
<P>
</DD>
</DL>
<DL>
<DT>.mb add menubutton .options -text Options -menu {<DD>
radiobutton byName -variable viewMode \
-value NAME -label "by Name"
radiobutton byDate -variable viewMode \
-value DATE -label "by Date"
}
<P>
</DD>
</DL>
<DL>
<DT>.mb add cascade .options.prefs -label Preferences -menu {<DD>
command colors -label Colors...
command fonts -label Fonts...
}
pack .mb -side left -anchor nw -fill x -expand yes
<P>
</DD>
</DL>
<H2><A NAME="sect11" HREF="#toc11"><B>CAVEATS</B></A></H2>
The <B>-menubuttons</B> option as well as the <B>-menu</B> option is
evaluated by menubar with the <B>subst</B> command. The positive
side of this is that the option string may contain variables,
commands, and/or backslash substitutions. However,
substitutions might expand into more than a single word.
These expansions can be protected by enclosing candidate
substitutions in curly braces ({}). This ensures, for example,
a value for an option will still be treated as a single
value and not multiple values. The following example illustrates
this case:
<P>
set fileMenuName "File Menu"<BR>
set var {}<BR>
menubar .mb -menubuttons {<BR>
menubutton file -text {$fileMenuName}
menubutton edit -text Edit -menu {
checkbutton check \<BR>
-label Check \
-variable {[scope var]} \
-onvalue 1 \<BR>
-offvalue 0<BR>
}<BR>
menubutton options -text Options
}
<P>
The variable <I>fileMenuName</I> will expand to "File Menu"
when the <B>subst</B> command is used on the menubutton
specification. In addition, the [<B>scope</B>...] command will
expand to @scope :: var. By enclosing these inside {}
they stay as a single value. Note that only {} work for
this. [list...], "" etc. will not protect these from
the subst command.
<P>
<H2><A NAME="sect12" HREF="#toc12"><B>ACKNOWLEDGMENTS</B></A></H2>
Bret Schumaker
<P>
1994 - Early work on a menubar widget.
<P>
Mark Ulferts, Mark Harrison, John Sigler
<P>
Invaluable feedback on grammar and usability of the
menubar widget
<P>
<H2><A NAME="sect13" HREF="#toc13"><B>AUTHOR</B></A></H2>
Bill W. Scott
<P>
<H2><A NAME="sect14" HREF="#toc14"><B>KEYWORDS</B></A></H2>
frame, menu, menubutton, entries, help
<P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc1" HREF="#sect1">NAME</A></LI>
<LI><A NAME="toc2" HREF="#sect2">SYNOPSIS</A></LI>
<LI><A NAME="toc3" HREF="#sect3">INHERITANCE</A></LI>
<LI><A NAME="toc4" HREF="#sect4">STANDARD OPTIONS</A></LI>
<LI><A NAME="toc5" HREF="#sect5">WIDGET-SPECIFIC OPTIONS</A></LI>
<LI><A NAME="toc6" HREF="#sect6">DESCRIPTION</A></LI>
<LI><A NAME="toc7" HREF="#sect7">MENU PATH NAMES</A></LI>
<LI><A NAME="toc8" HREF="#sect8">WIDGET-SPECIFIC METHODS</A></LI>
<LI><A NAME="toc9" HREF="#sect9">EXAMPLE ONE: USING GRAMMAR</A></LI>
<LI><A NAME="toc10" HREF="#sect10">EXAMPLE TWO: USING METHODS</A></LI>
<LI><A NAME="toc11" HREF="#sect11">CAVEATS</A></LI>
<LI><A NAME="toc12" HREF="#sect12">ACKNOWLEDGMENTS</A></LI>
<LI><A NAME="toc13" HREF="#sect13">AUTHOR</A></LI>
<LI><A NAME="toc14" HREF="#sect14">KEYWORDS</A></LI>
</UL>
</BODY></HTML>
|