home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / menubar.n < prev    next >
Encoding:
Text File  |  1993-04-01  |  6.8 KB  |  154 lines

  1. '\"
  2. '\" Copyright (c) 1992 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/menubar.n,v 1.3 93/04/01 09:52:45 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS tk_menuBar tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. tk_menuBar, tk_bindForTraversal \- Support for menu bars
  29. .SH SYNOPSIS
  30. \fBtk_menuBar \fIframe \fR?\fImenu menu ...\fR?
  31. .sp
  32. \fBtk_bindForTraversal \fIarg arg ... \fR
  33. .BE
  34.  
  35. .SH DESCRIPTION
  36. .PP
  37. These two commands are Tcl procedures in the Tk script library.
  38. They provide support for menu bars.
  39. A menu bar is a frame that contains a collection of menu buttons that
  40. work together, so that the user can scan from one menu to another with
  41. the mouse: if the mouse button is pressed over one menubutton (causing it
  42. to post its menu) and the mouse is moved over another menubutton
  43. in the same menu bar without releasing the mouse button, then the
  44. menu of the first menubutton is unposted and the menu of the
  45. new menubutton is posted instead.
  46. Menus in a menu bar can also be accessed using keyboard traversal (i.e.
  47. by typing keystrokes instead of using the mouse).
  48. In order for an application to use these procedures, it must do three
  49. things, which are described in the paragraphs below.
  50. .PP
  51. First, each application must call \fBtk_menuBar\fR to provide information
  52. about the menubar.
  53. The \fIframe\fR argument gives the path name of the frame that contains
  54. all of the menu buttons, and the \fImenu\fR arguments give path names
  55. for all of the menu buttons associated with the menu bar.
  56. Normally \fIframe\fR is the parent of each of the \fImenu\fR's.
  57. This need not be the case, but \fIframe\fR must be an ancestor of
  58. each of the \fImenu\fR's in order for grabs to work correctly when
  59. the mouse is used to pull down menus.
  60. The order of the \fImenu\fR arguments determines the traversal order
  61. for the menu buttons.
  62. If \fBtk_menuBar\fR is called without any \fImenu\fR arguments, it
  63. returns a list containing the current menu buttons for \fIframe\fR,
  64. or an empty string if \fIframe\fR isn't currently set up as a menu bar.
  65. If \fBtk_menuBar\fR is called with a single \fImenu\fR argument
  66. consisting of an empty string, any menubar information for \fIframe\fR
  67. is removed;  from now on the menu buttons will function independently
  68. without keyboard traversal.
  69. Only one menu bar may be defined at a time within each top-level window.
  70. .PP
  71. The second thing an application must do is to identify the traversal
  72. characters for menu buttons and menu entries.
  73. This is done by underlining those characters using the
  74. \fB\-underline\fR options for the widgets.
  75. The menu traversal system uses this information to traverse the
  76. menus under keyboard control (see below).
  77. .PP
  78. The third thing that an application must do
  79. is to make sure that the input focus is always in a window that
  80. has been configured to support menu traversal.
  81. If the input focus is \fBnone\fR then input characters will
  82. be discarded and no menu traversal will be possible.
  83. By default, the Tk startup scripts configure all the Tk widget classes to
  84. support menu traversal (they call the \fBtk_bindForTraversal\fR
  85. procedure described below).
  86. .PP
  87. If your application defines new classes of widgets that support the
  88. input focus, then you should call \fBtk_bindForTraversal\fR for
  89. each of these classes.
  90. \fBTk_bindForTraversal\fR takes any number of arguments, each of
  91. which is a widget path name or widget class name.
  92. It sets up bindings for all the named widgets and
  93. classes so that the menu traversal system will be invoked when
  94. appropriate keystrokes are typed in those widgets or classes.
  95. .PP
  96. Typically, applications will also call \fBtk_bindForTraversal\fR
  97. on their main window (``.'') and set the input focus to that window
  98. whenever it doesn't make sense for it to be anywhere else.
  99. This guarantees that menu traversal will be possible even when
  100. there is no other input focus.
  101.  
  102. .SH "MENU TRAVERSAL BINDINGS"
  103. .PP
  104. Once an application has made the three arrangements described
  105. above, menu traversal will be available.
  106. At any given time, the only menus available for traversal
  107. are those associated with the top-level window containing the
  108. input focus.
  109. Menu traversal is initiated by one of the following actions:
  110. .IP [1]
  111. If <F10> is typed, then the first menu button in the list for the
  112. top-level window is posted and the first entry within that
  113. menu is selected.
  114. .IP [2]
  115. If <Alt-\fIkey\fR> is pressed, then the menu button that has \fIkey\fR
  116. as its underlined character is posted
  117. and the first entry within that menu is selected.
  118. The comparison between \fIkey\fR and the underlined characters
  119. ignores case differences.
  120. If no menu button matches \fIkey\fR then the keystroke has no
  121. effect.
  122. .IP [3]
  123. Clicking mouse button 1 on a menu button posts that menu and selects
  124. its first entry.
  125. .PP
  126. Once a menu has been posted, the input focus is switched to that
  127. menu and the following actions are possible:
  128. .IP [1]
  129. Typing <ESC> or clicking mouse button 1 outside the menu button or
  130. its menu will abort the menu traversal.
  131. .IP [2]
  132. If <Alt-\fIkey\fR> is pressed, then the entry in the posted menu
  133. whose underlined character is \fIkey\fR is invoked.
  134. This causes the menu to be unposted, the entry's action to be
  135. taken, and the menu traversal to end.
  136. The comparison between \fIkey\fR and underlined characters ignores
  137. case differences.
  138. If no menu entry matches \fIkey\fR then the keystroke is ignored.
  139. .IP [3]
  140. The arrow keys may be used to move among entries and menus.
  141. The left and right arrow keys move circularly among the available
  142. menus and the up and down arrow keys move circularly among the
  143. entries in the current menu.
  144. .IP [4]
  145. If <Return> is pressed, the selected entry in the posted menu is
  146. invoked, which causes the menu to be unposted, the entry's action
  147. to be taken, and the menu traversal to end.
  148. .PP
  149. When a menu traversal completes, the input focus reverts to the
  150. window that contained it when the traversal started.
  151.  
  152. .SH KEYWORDS
  153. keyboard traversal, menu, menu bar, post
  154.