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

  1. '\"
  2. '\" Copyright (c) 1990 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/checkbutton.n,v 1.22 93/04/01 09:52:35 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS checkbutton tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. checkbutton \- Create and manipulate check-button widgets
  29. .SH SYNOPSIS
  30. \fBcheckbutton\fI pathName \fR?\fIoptions\fR?
  31. .SH "STANDARD OPTIONS"
  32. .LP
  33. .nf
  34. .ta 4c 8c 12c
  35. .VS
  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
  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. Name:    \fBcommand\fR
  49. Class:    \fBCommand\fR
  50. Command-Line Switch:    \fB\-command\fR
  51. .fi
  52. .IP
  53. Specifies a Tcl command to associate with the button.  This command
  54. is typically invoked when mouse button 1 is released over the button
  55. window.  The button's global variable (\fB\-variable\fR option) will
  56. be updated before the command is invoked.
  57. .LP
  58. .nf
  59. .VS
  60. Name:    \fBheight\fR
  61. Class:    \fBHeight\fR
  62. Command-Line Switch:    \fB\-height\fR
  63. .fi
  64. .IP
  65. Specifies a desired height for the button.
  66. If a bitmap is being displayed in the button then the value is in
  67. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  68. for text it is in lines of text.
  69. If this option isn't specified, the button's desired height is computed
  70. from the size of the bitmap or text being displayed in it.
  71. .VE
  72. .LP
  73. .nf
  74. Name:    \fBoffValue\fR
  75. Class:    \fBValue\fR
  76. Command-Line Switch:    \fB\-offvalue\fR
  77. .fi
  78. .IP
  79. Specifies value to store in the button's associated variable whenever
  80. this button is deselected.  Defaults to ``0''.
  81. .LP
  82. .nf
  83. Name:    \fBonValue\fR
  84. Class:    \fBValue\fR
  85. Command-Line Switch:    \fB\-onvalue\fR
  86. .fi
  87. .IP
  88. Specifies value to store in the button's associated variable whenever
  89. this button is selected.  Defaults to ``1''.
  90. .LP
  91. .nf
  92. Name:    \fBselector\fR
  93. Class:    \fBForeground\fR
  94. Command-Line Switch:    \fB\-selector\fR
  95. .fi
  96. .IP
  97. Specifies the color to draw in the selector when this button is
  98. selected.
  99. .VS
  100. If specified as an empty string then no selector is
  101. drawn for the button.
  102. .LP
  103. .nf
  104. Name:    \fBstate\fR
  105. Class:    \fBState\fR
  106. Command-Line Switch:    \fB\-state\fR
  107. .fi
  108. .IP
  109. Specifies one of three states for the check button:  \fBnormal\fR, \fBactive\fR,
  110. or \fBdisabled\fR.  In normal state the check button is displayed using the
  111. \fBforeground\fR and \fBbackground\fR options.  The active state is
  112. typically used when the pointer is over the check button.  In active state
  113. the check button is displayed using the \fBactiveForeground\fR and
  114. \fBactiveBackground\fR options.  Disabled state means that the check button
  115. is insensitive:  it doesn't activate and doesn't respond to mouse
  116. button presses.  In this state the \fBdisabledForeground\fR and
  117. \fBbackground\fR options determine how the check button is displayed.
  118. .VE
  119. .LP
  120. .nf
  121. Name:    \fBvariable\fR
  122. Class:    \fBVariable\fR
  123. Command-Line Switch:    \fB\-variable\fR
  124. .fi
  125. .IP
  126. Specifies name of global variable to set to indicate whether
  127. or not this button is selected.  Defaults to the name of the
  128. button within its parent (i.e. the last element of the button
  129. window's path name).
  130. .LP
  131. .nf
  132. .VS
  133. Name:    \fBwidth\fR
  134. Class:    \fBWidth\fR
  135. Command-Line Switch:    \fB\-width\fR
  136. .fi
  137. .IP
  138. Specifies a desired width for the button.
  139. If a bitmap is being displayed in the button then the value is in
  140. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  141. for text it is in characters.
  142. If this option isn't specified, the button's desired width is computed
  143. from the size of the bitmap or text being displayed in it.
  144. .VE
  145. .BE
  146.  
  147. .SH DESCRIPTION
  148. .PP
  149. The \fBcheckbutton\fR command creates a new window (given by the
  150. \fIpathName\fR argument) and makes it into a check-button widget.
  151. Additional
  152. options, described above, may be specified on the command line
  153. or in the option database
  154. to configure aspects of the check button such as its colors, font,
  155. text, and initial relief.  The \fBcheckbutton\fR command returns its
  156. \fIpathName\fR argument.  At the time this command is invoked,
  157. there must not exist a window named \fIpathName\fR, but
  158. \fIpathName\fR's parent must exist.
  159. .PP
  160. A check button is a widget
  161. .VS
  162. that displays a textual string or bitmap
  163. and a square called a \fIselector\fR.
  164. A check button has
  165. all of the behavior of a simple button, including the
  166. following: it can display itself in either of three different
  167. ways, according to the \fBstate\fR option;
  168. .VE
  169. it can be made to appear
  170. raised, sunken, or flat; it can be made to flash; and it invokes
  171. a Tcl command whenever mouse button 1 is clicked over the
  172. check button.
  173. .PP
  174. In addition, check buttons can be \fIselected\fR.  If a check button is
  175. selected then a special highlight appears in the selector, and
  176. a Tcl variable associated with the check button is set to a particular
  177. value (normally 1).  If the check button is not selected, then
  178. the selector is drawn in a different fashion and the associated
  179. variable is set to a different value (typically 0).  By default,
  180. the name of the variable associated with a check button is the
  181. same as the \fIname\fR used to create the check button.  The
  182. variable name, and the ``on'' and ``off'' values stored in it,
  183. may be modified with options on the command line or in the option
  184. database.  By default a check button is configured to select and deselect
  185. itself on alternate button clicks.
  186. .VS
  187. In addition, each check button monitors its associated variable and
  188. automatically selects and deselects itself when the variables value
  189. changes to and from the button's ``on'' value.
  190. .VE
  191.  
  192. .SH "WIDGET COMMAND"
  193. .PP
  194. The \fBcheckbutton\fR command creates a new Tcl command whose
  195. name is \fIpathName\fR.  This
  196. command may be used to invoke various
  197. operations on the widget.  It has the following general form:
  198. .DS C
  199. \fIpathName option \fR?\fIarg arg ...\fR?
  200. .DE
  201. \fIOption\fR and the \fIarg\fRs
  202. determine the exact behavior of the command.  The following
  203. commands are possible for check button widgets:
  204. .TP
  205. \fIpathName \fBactivate\fR
  206. Change the check button's state to \fBactive\fR and redisplay the button
  207. using its active foreground and background colors instead of normal
  208. colors.
  209. .VS
  210. This command is ignored if the check button's state is \fBdisabled\fR.
  211. This command is obsolete and will eventually be removed;
  212. use ``\fIpathName \fBconfigure \-state active\fR'' instead.
  213. .VE
  214. .TP
  215. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  216. Query or modify the configuration options of the widget.
  217. If no \fIoption\fR is specified, returns a list describing all of
  218. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  219. information on the format of this list).  If \fIoption\fR is specified
  220. with no \fIvalue\fR, then the command returns a list describing the
  221. one named option (this list will be identical to the corresponding
  222. sublist of the value returned if no \fIoption\fR is specified).  If
  223. one or more \fIoption\-value\fR pairs are specified, then the command
  224. modifies the given widget option(s) to have the given value(s);  in
  225. this case the command returns an empty string.
  226. \fIOption\fR may have any of the values accepted by the \fBcheckbutton\fR
  227. command.
  228. .TP
  229. \fIpathName \fBdeactivate\fR
  230. Change the check button's state to \fBnormal\fR and redisplay the button
  231. using its normal foreground and background colors.
  232. .VS
  233. This command is ignored if the check button's state is \fBdisabled\fR.
  234. This command is obsolete and will eventually be removed;
  235. use ``\fIpathName \fBconfigure \-state normal\fR'' instead.
  236. .VE
  237. .TP
  238. \fIpathName \fBdeselect\fR
  239. Deselect the check button:  redisplay it without a highlight in
  240. the selector and set the associated variable to its ``off''
  241. value.
  242. .TP
  243. \fIpathName \fBflash\fR
  244. Flash the check button.  This is accomplished by redisplaying the check button
  245. several times, alternating between active and normal colors.  At
  246. the end of the flash the check button is left in the same normal/active
  247. state as when the command was invoked.
  248. .VS
  249. This command is ignored if the check button's state is \fBdisabled\fR.
  250. .VE
  251. .TP
  252. \fIpathName \fBinvoke\fR
  253. .VS
  254. Does just what would have happened if the user invoked the check button
  255. with the mouse: toggle the selection state of the button and invoke
  256. the Tcl command associated with the check button, if there is one.
  257. The return value is the return value from the Tcl command, or an
  258. empty string if there is no command associated with the check button.
  259. This command is ignored if the check button's state is \fBdisabled\fR.
  260. .VE
  261. .TP
  262. \fIpathName \fBselect\fR
  263. Select the check button:  display it with a highlighted
  264. selector and set the associated variable to its ``on''
  265. value.
  266. .TP
  267. \fIpathName \fBtoggle\fR
  268. Toggle the selection state of the button, redisplaying it and
  269. modifying its associated variable to reflect the new state.
  270.  
  271. .SH BINDINGS
  272. .PP
  273. .VS
  274. Tk automatically creates class bindings for check buttons that give them
  275. the following default behavior:
  276. .IP [1]
  277. The check button activates whenever the mouse passes over it and deactivates
  278. whenever the mouse leaves the check button.
  279. .IP [2]
  280. The check button's relief is changed to sunken whenever mouse button 1 is
  281. pressed over it, and the relief is restored to its original
  282. value when button 1 is later released.
  283. .IP [3]
  284. If mouse button 1 is pressed over the check button and later released over
  285. the check button, the check button is invoked (i.e. its selection
  286. state toggles and the command associated with the button is invoked,
  287. if there is one).  However, if the mouse is not
  288. over the check button when button 1 is released, then no invocation occurs.
  289. .PP
  290. If the check button's state is \fBdisabled\fR then none of the above
  291. actions occur:  the check button is completely non-responsive.
  292. .PP
  293. The behavior of check buttons can be changed by defining new bindings for
  294. individual widgets or by redefining the class bindings.
  295. .VE
  296.  
  297. .SH KEYWORDS
  298. check button, widget
  299.