home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / radiobutton.n < prev    next >
Encoding:
Text File  |  1993-04-01  |  10.4 KB  |  286 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/radiobutton.n,v 1.21 93/04/01 09:52:52 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS radiobutton tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. radiobutton \- Create and manipulate radio-button widgets
  29. .SH SYNOPSIS
  30. \fBradiobutton\fI \fIpathName \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    \fBpadX\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:    \fBselector\fR
  75. Class:    \fBForeground\fR
  76. Command-Line Switch:    \fB\-selector\fR
  77. .fi
  78. .IP
  79. Specifies the color to draw in the selector when this button is
  80. selected.
  81. .VS
  82. If specified as an empty string then no selector is drawn for the button.
  83. .LP
  84. .nf
  85. Name:    \fBstate\fR
  86. Class:    \fBState\fR
  87. Command-Line Switch:    \fB\-state\fR
  88. .fi
  89. .IP
  90. Specifies one of three states for the radio button:  \fBnormal\fR, \fBactive\fR,
  91. or \fBdisabled\fR.  In normal state the radio button is displayed using the
  92. \fBforeground\fR and \fBbackground\fR options.  The active state is
  93. typically used when the pointer is over the radio button.  In active state
  94. the radio button is displayed using the \fBactiveForeground\fR and
  95. \fBactiveBackground\fR options.  Disabled state means that the radio button
  96. is insensitive:  it doesn't activate and doesn't respond to mouse
  97. button presses.  In this state the \fBdisabledForeground\fR and
  98. \fBbackground\fR options determine how the radio button is displayed.
  99. .VE
  100. .LP
  101. .nf
  102. Name:    \fBvalue\fR
  103. Class:    \fBValue\fR
  104. Command-Line Switch:    \fB\-value\fR
  105. .fi
  106. .IP
  107. Specifies value to store in the button's associated variable whenever
  108. this button is selected.  Defaults to the name of the radio button.
  109. .LP
  110. .nf
  111. Name:    \fBvariable\fR
  112. Class:    \fBVariable\fR
  113. Command-Line Switch:    \fB\-variable\fR
  114. .fi
  115. .IP
  116. Specifies name of global variable to set whenever this button is
  117. selected.  Changes in this variable also cause the button to select
  118. or deselect itself.
  119. Defaults to the value \fBselectedButton\fR.
  120. .LP
  121. .nf
  122. .VS
  123. Name:    \fBwidth\fR
  124. Class:    \fBWidth\fR
  125. Command-Line Switch:    \fB\-width\fR
  126. .fi
  127. .IP
  128. Specifies a desired width for the button.
  129. If a bitmap is being displayed in the button then the value is in
  130. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  131. for text it is in characters.
  132. If this option isn't specified, the button's desired width is computed
  133. from the size of the bitmap or text being displayed in it.
  134. .VE
  135. .BE
  136.  
  137. .SH DESCRIPTION
  138. .PP
  139. The \fBradiobutton\fR command creates a new window (given by the
  140. \fIpathName\fR argument) and makes it into a radiobutton widget.
  141. Additional
  142. options, described above, may be specified on the command line
  143. or in the option database
  144. to configure aspects of the radio button such as its colors, font,
  145. text, and initial relief.  The \fBradiobutton\fR command returns its
  146. \fIpathName\fR argument.  At the time this command is invoked,
  147. there must not exist a window named \fIpathName\fR, but
  148. \fIpathName\fR's parent must exist.
  149. .PP
  150. A radio button is a widget
  151. .VS
  152. that displays a textual string or bitmap
  153. and a diamond called a \fIselector\fR.
  154. A radio button has
  155. all of the behavior of a simple button: it can display itself in either
  156. of three different ways, according to the \fBstate\fR option;
  157. .VE
  158. it can be made to appear
  159. raised, sunken, or flat; it can be made to flash; and it invokes
  160. a Tcl command whenever mouse button 1 is clicked over the
  161. check button.
  162. .PP
  163. In addition, radio buttons can be \fIselected\fR.
  164. If a radio button is selected then a special highlight appears
  165. in the selector and a Tcl variable associated with the radio button
  166. is set to a particular value.
  167. If the radio button is not selected then the selector is drawn
  168. in a different fashion.
  169. Typically, several radio buttons share a single variable and the
  170. value of the variable indicates which radio button is to be selected.
  171. .VS
  172. When a radio button is selected it sets the value of the variable to
  173. indicate that fact;  each radio button also monitors the value of
  174. the variable and automatically selects and deselects itself when the
  175. variable's value changes.
  176. .VE
  177. By default the variable \fBselectedButton\fR
  178. is used;  its contents give the name of the button that is
  179. selected, or the empty string if no button associated with that
  180. variable is selected.
  181. The name of the variable for a radio button,
  182. plus the variable to be stored into it, may be modified with options
  183. on the command line or in the option database.  By default a radio
  184. button is configured to select itself on button clicks.
  185.  
  186. .SH "WIDGET COMMAND"
  187. .PP
  188. The \fBradiobutton\fR command creates a new Tcl command whose
  189. name is \fIpathName\fR.  This
  190. command may be used to invoke various
  191. operations on the widget.  It has the following general form:
  192. .DS C
  193. \fIpathName option \fR?\fIarg arg ...\fR?
  194. .DE
  195. \fIOption\fR and the \fIarg\fRs
  196. determine the exact behavior of the command.  The following
  197. commands are possible for radio-button widgets:
  198. .TP
  199. \fIpathName \fBactivate\fR
  200. Change the radio button's state to \fBactive\fR and redisplay the button
  201. using its active foreground and background colors instead of normal
  202. colors.
  203. .VS
  204. This command is ignored if the radio button's state is \fBdisabled\fR.
  205. This command is obsolete and will eventually be removed;
  206. use ``\fIpathName \fBconfigure \-state active\fR'' instead.
  207. .TP
  208. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  209. Query or modify the configuration options of the widget.
  210. If no \fIoption\fR is specified, returns a list describing all of
  211. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  212. information on the format of this list).  If \fIoption\fR is specified
  213. with no \fIvalue\fR, then the command returns a list describing the
  214. one named option (this list will be identical to the corresponding
  215. sublist of the value returned if no \fIoption\fR is specified).  If
  216. one or more \fIoption\-value\fR pairs are specified, then the command
  217. modifies the given widget option(s) to have the given value(s);  in
  218. this case the command returns an empty string.
  219. \fIOption\fR may have any of the values accepted by the \fBradiobutton\fR
  220. command.
  221. .TP
  222. \fIpathName \fBdeactivate\fR
  223. Change the radio button's state to \fBnormal\fR and redisplay the button
  224. using its normal foreground and background colors.
  225. .VS
  226. This command is ignored if the radio button's state is \fBdisabled\fR.
  227. This command is obsolete and will eventually be removed;
  228. use ``\fIpathName \fBconfigure \-state normal\fR'' instead.
  229. .VE
  230. .TP
  231. \fIpathName \fBdeselect\fR
  232. Deselect the radio button:  redisplay it without a highlight in
  233. the selector and set the associated variable to an empty string.  If
  234. this radio button was not currently selected, then the command has
  235. no effect.
  236. .TP
  237. \fIpathName \fBflash\fR
  238. Flash the radio button.  This is accomplished by redisplaying the radio button
  239. several times, alternating between active and normal colors.  At
  240. the end of the flash the radio button is left in the same normal/active
  241. state as when the command was invoked.
  242. .VS
  243. This command is ignored if the radio button's state is \fBdisabled\fR.
  244. .VE
  245. .TP
  246. \fIpathName \fBinvoke\fR
  247. .VS
  248. Does just what would have happened if the user invoked the radio button
  249. with the mouse: select the button and invoke
  250. its associated Tcl command, if there is one.
  251. The return value is the return value from the Tcl command, or an
  252. empty string if there is no command associated with the radio button.
  253. This command is ignored if the radio button's state is \fBdisabled\fR.
  254. .VE
  255. .TP
  256. \fIpathName \fBselect\fR
  257. Select the radio button:  display it with a highlighted
  258. selector and set the associated variable to the value corresponding
  259. to this widget.
  260.  
  261. .SH BINDINGS
  262. .PP
  263. .VS
  264. Tk automatically creates class bindings for radio buttons that give them
  265. the following default behavior:
  266. .IP [1]
  267. The radio button activates whenever the mouse passes over it and deactivates
  268. whenever the mouse leaves the radio button.
  269. .IP [2]
  270. The radio button's relief is changed to sunken whenever mouse button 1 is
  271. pressed over it, and the relief is restored to its original
  272. value when button 1 is later released.
  273. .IP [3]
  274. If mouse button 1 is pressed over the radio button and later released over
  275. the radio button, the radio button is invoked (i.e. it is selected
  276. and the command associated with the button is invoked,
  277. if there is one).  However, if the mouse is not
  278. over the radio button when button 1 is released, then no invocation occurs.
  279. .PP
  280. The behavior of radio buttons can be changed by defining new bindings for
  281. individual widgets or by redefining the class bindings.
  282. .VE
  283.  
  284. .SH KEYWORDS
  285. radio button, widget
  286.