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

  1. '\"
  2. '\" Copyright (c) 1990-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/menubutton.n,v 1.15 93/04/01 09:52:46 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS menubutton tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. menubutton \- Create and manipulate menubutton widgets
  29. .SH SYNOPSIS
  30. \fBmenubutton\fI \fIpathName \fR?\fIoptions\fR?
  31. .SH "STANDARD OPTIONS"
  32. .LP
  33. .nf
  34. .VS
  35. .ta 4c 8c 12c
  36. \fBactiveBackground\fR    \fBbitmap\fR    \fBfont\fR    \fBrelief\fR
  37. \fBactiveForeground\fR    \fBborderWidth\fR    \fBforeground\fR    \fBtext\fR
  38. \fBanchor\fR    \fBcursor\fR    \fBpadX\fR    \fBtextVariable\fR
  39. \fBbackground\fR    \fBdisabledForeground\fR    \fBpadY\fR    \fBunderline\fR
  40. .VE
  41. .fi
  42. .LP
  43. See the ``options'' manual entry for details on the standard options.
  44. .SH "WIDGET-SPECIFIC OPTIONS"
  45. .ta 4c
  46. .LP
  47. .nf
  48. .VS
  49. Name:    \fBheight\fR
  50. Class:    \fBHeight\fR
  51. Command-Line Switch:    \fB\-height\fR
  52. .fi
  53. .IP
  54. Specifies a desired height for the menu button.
  55. If a bitmap is being displayed in the menu button then the value is in
  56. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  57. for text it is in lines of text.
  58. If this option isn't specified, the menu button's desired height is computed
  59. from the size of the bitmap or text being displayed in it.
  60. .VE
  61. .LP
  62. .nf
  63. Name:    \fBmenu\fR
  64. Class:    \fBMenuName\fR
  65. Command-Line Switch:    \fB\-menu\fR
  66. .fi
  67. .IP
  68. Specifies the path name of the menu associated with this menubutton.
  69. .VS
  70. The menu must be a descendant of the menubutton in order for normal pull-down
  71. operation to work via the mouse.
  72. .VE
  73. .LP
  74. .nf
  75. Name:    \fBstate\fR
  76. Class:    \fBState\fR
  77. Command-Line Switch:    \fB\-state\fR
  78. .fi
  79. .IP
  80. Specifies one of three states for the menu button:  \fBnormal\fR, \fBactive\fR,
  81. or \fBdisabled\fR.  In normal state the menu button is displayed using the
  82. \fBforeground\fR and \fBbackground\fR options.  The active state is
  83. typically used when the pointer is over the menu button.  In active state
  84. the menu button is displayed using the \fBactiveForeground\fR and
  85. \fBactiveBackground\fR options.  Disabled state means that the menu button
  86. is insensitive:  it doesn't activate and doesn't respond to mouse
  87. button presses.  In this state the \fBdisabledForeground\fR and
  88. \fBbackground\fR options determine how the button is displayed.
  89. .LP
  90. .nf
  91. .VS
  92. Name:    \fBwidth\fR
  93. Class:    \fBWidth\fR
  94. Command-Line Switch:    \fB\-width\fR
  95. .fi
  96. .IP
  97. Specifies a desired width for the menu button.
  98. If a bitmap is being displayed in the menu button then the value is in
  99. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  100. for text it is in characters.
  101. If this option isn't specified, the menu button's desired width is computed
  102. from the size of the bitmap or text being displayed in it.
  103. .VE
  104. .BE
  105.  
  106. .SH INTRODUCTION
  107. .PP
  108. The \fBmenubutton\fR command creates a new window (given by the
  109. \fIpathName\fR argument) and makes it into a menubutton widget.
  110. Additional
  111. options, described above, may be specified on the command line
  112. or in the option database
  113. to configure aspects of the menubutton such as its colors, font,
  114. text, and initial relief.  The \fBmenubutton\fR command returns its
  115. \fIpathName\fR argument.  At the time this command is invoked,
  116. there must not exist a window named \fIpathName\fR, but
  117. \fIpathName\fR's parent must exist.
  118. .PP
  119. A menubutton is a widget that displays a
  120. .VS
  121. textual string or bitmap
  122. .VE
  123. and is associated with a menu widget.  In normal usage, pressing
  124. mouse button 1 over the menubutton causes the associated menu to
  125. be posted just underneath the menubutton.  If the mouse is moved over
  126. the menu before releasing the mouse button, the button release
  127. causes the underlying menu entry to be invoked.  When the button
  128. is released, the menu is unposted.
  129. .PP
  130. .VS
  131. Menubuttons are typically organized into groups called menu bars
  132. that allow scanning:
  133. if the mouse button is pressed over one menubutton (causing it
  134. to post its menu) and the mouse is moved over another menubutton
  135. in the same menu bar without releasing the mouse button, then the
  136. menu of the first menubutton is unposted and the menu of the
  137. new menubutton is posted instead.
  138. The \fBtk_menuBar\fR procedure is used to set up menu bars for
  139. scanning; see that procedure for more details.
  140. .VE
  141.  
  142. .SH "WIDGET COMMAND"
  143. .PP
  144. The \fBmenubutton\fR command creates a new Tcl command whose
  145. name is \fIpathName\fR.  This
  146. command may be used to invoke various
  147. operations on the widget.  It has the following general form:
  148. .DS C
  149. \fIpathName option \fR?\fIarg arg ...\fR?
  150. .DE
  151. \fIOption\fR and the \fIarg\fRs
  152. determine the exact behavior of the command.  The following
  153. commands are possible for menubutton widgets:
  154. .TP
  155. \fIpathName \fBactivate\fR
  156. Change the menu button's state to \fBactive\fR and redisplay the menu
  157. button using its active foreground and background colors instead of normal
  158. colors.
  159. The command returns an empty string.
  160. .VS
  161. This command is ignored if the menu button's state is \fBdisabled\fR.
  162. This command is obsolete and will eventually be removed;
  163. use ``\fIpathName \fBconfigure \-state active\fR'' instead.
  164. .VE
  165. .TP
  166. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  167. Query or modify the configuration options of the widget.
  168. If no \fIoption\fR is specified, returns a list describing all of
  169. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  170. information on the format of this list).  If \fIoption\fR is specified
  171. with no \fIvalue\fR, then the command returns a list describing the
  172. one named option (this list will be identical to the corresponding
  173. sublist of the value returned if no \fIoption\fR is specified).  If
  174. one or more \fIoption\-value\fR pairs are specified, then the command
  175. modifies the given widget option(s) to have the given value(s);  in
  176. this case the command returns an empty string.
  177. \fIOption\fR may have any of the values accepted by the \fBmenubutton\fR
  178. command.
  179. .TP
  180. \fIpathName \fBdeactivate\fR
  181. Change the menu button's state to \fBnormal\fR and redisplay the menu
  182. button using its normal foreground and background colors.
  183. The command returns an empty string.
  184. .VS
  185. This command is ignored if the menu button's state is \fBdisabled\fR.
  186. This command is obsolete and will eventually be removed;
  187. use ``\fIpathName \fBconfigure \-state normal\fR'' instead.
  188. .VE
  189.  
  190. .SH "DEFAULT BINDINGS"
  191. .PP
  192. .VS
  193. Tk automatically creates class bindings for menu buttons that give them
  194. the following default behavior:
  195. .IP [1]
  196. A menu button activates whenever the mouse passes over it and deactivates
  197. whenever the mouse leaves it.
  198. .IP [2]
  199. A menu button's relief is changed to raised whenever mouse button 1 is
  200. pressed over it, and the relief is restored to its original value
  201. when button 1 is later released or the mouse is dragged into another
  202. menu button in the same menu bar.
  203. .IP [3]
  204. When mouse button 1 is pressed over a menu button, or when the mouse
  205. is dragged into a menu button with mouse button 1 pressed, the associated
  206. menu is posted;  the mouse can be dragged across the menu and released
  207. over an entry in the menu to invoke that entry.  The menu is unposted
  208. when button 1 is released outside either the menu or the menu button.
  209. The menu is also unposted when the mouse is dragged into another
  210. menu button in the same menu bar.
  211. .IP [4]
  212. If mouse button 1 is pressed and released within the menu button,
  213. then the menu stays posted and keyboard traversal is possible as
  214. described in the manual entry for \fBtk_menuBar\fR.
  215. .IP [5]
  216. Menubuttons may also be posted by typing characters on the keyboard.
  217. See the manual entry for \fBtk_menuBar\fR for full details on keyboard
  218. menu traversal.
  219. .IP [6]
  220. If mouse button 2 is pressed over a menu button then the associated
  221. menu is posted and also \fItorn off\fR:  it can then be dragged around on
  222. the screen with button 2 and the menu will not automatically unpost when
  223. entries in it are invoked.
  224. To close a torn off menu, click mouse button 1 over the associated
  225. menu button.
  226. .PP
  227. If the menu button's state is \fBdisabled\fR then none of the above
  228. actions occur:  the menu button is completely non-responsive.
  229. .PP
  230. The behavior of menu buttons can be changed by defining new bindings for
  231. individual widgets or by redefining the class bindings.
  232. .VE
  233.  
  234. .SH KEYWORDS
  235. menubutton, widget
  236.