home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / button.n < prev    next >
Encoding:
Text File  |  1993-04-01  |  7.8 KB  |  217 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/button.n,v 1.19 93/04/01 09:52:31 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS button tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. button \- Create and manipulate button widgets
  29. .SH SYNOPSIS
  30. \fBbutton\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    \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.
  56. .LP
  57. .nf
  58. .VS
  59. Name:    \fBheight\fR
  60. Class:    \fBHeight\fR
  61. Command-Line Switch:    \fB\-height\fR
  62. .fi
  63. .IP
  64. Specifies a desired height for the button.
  65. If a bitmap is being displayed in the button then the value is in
  66. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  67. for text it is in lines of text.
  68. If this option isn't specified, the button's desired height is computed
  69. from the size of the bitmap or text being displayed in it.
  70. .LP
  71. .nf
  72. Name:    \fBstate\fR
  73. Class:    \fBState\fR
  74. Command-Line Switch:    \fB\-state\fR
  75. .fi
  76. .IP
  77. Specifies one of three states for the button:  \fBnormal\fR, \fBactive\fR,
  78. or \fBdisabled\fR.  In normal state the button is displayed using the
  79. \fBforeground\fR and \fBbackground\fR options.  The active state is
  80. typically used when the pointer is over the button.  In active state
  81. the button is displayed using the \fBactiveForeground\fR and
  82. \fBactiveBackground\fR options.  Disabled state means that the button
  83. is insensitive:  it doesn't activate and doesn't respond to mouse
  84. button presses.  In this state the \fBdisabledForeground\fR and
  85. \fBbackground\fR options determine how the button is displayed.
  86. .LP
  87. .nf
  88. Name:    \fBwidth\fR
  89. Class:    \fBWidth\fR
  90. Command-Line Switch:    \fB\-width\fR
  91. .fi
  92. .IP
  93. Specifies a desired width for the button.
  94. If a bitmap is being displayed in the button then the value is in
  95. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  96. for text it is in characters.
  97. If this option isn't specified, the button's desired width is computed
  98. from the size of the bitmap or text being displayed in it.
  99. .VE
  100. .BE
  101.  
  102. .SH DESCRIPTION
  103. .PP
  104. The \fBbutton\fR command creates a new window (given by the
  105. \fIpathName\fR argument) and makes it into a button widget.
  106. Additional
  107. options, described above, may be specified on the command line
  108. or in the option database
  109. to configure aspects of the button such as its colors, font,
  110. text, and initial relief.  The \fBbutton\fR command returns its
  111. \fIpathName\fR argument.  At the time this command is invoked,
  112. there must not exist a window named \fIpathName\fR, but
  113. \fIpathName\fR's parent must exist.
  114. .PP
  115. A button is a widget
  116. .VS
  117. that displays a textual string or bitmap.
  118. It can display itself in either of three different ways, according
  119. to
  120. the \fBstate\fR option; 
  121. .VE
  122. it can be made to appear raised, sunken, or flat;
  123. and it can be made to flash.  When a user invokes the
  124. button (by pressing mouse button 1 with the cursor over the
  125. button), then the Tcl command specified in the \fB\-command\fR
  126. option is invoked.
  127.  
  128. .SH "WIDGET COMMAND"
  129. .PP
  130. The \fBbutton\fR command creates a new Tcl command whose
  131. name is \fIpathName\fR.  This
  132. command may be used to invoke various
  133. operations on the widget.  It has the following general form:
  134. .DS C
  135. \fIpathName option \fR?\fIarg arg ...\fR?
  136. .DE
  137. \fIOption\fR and the \fIarg\fRs
  138. determine the exact behavior of the command.  The following
  139. commands are possible for button widgets:
  140. .TP
  141. \fIpathName \fBactivate\fR
  142. Change the button's state to \fBactive\fR and redisplay the button
  143. using its active foreground and background colors instead of normal
  144. colors.
  145. .VS
  146. This command is ignored if the button's state is \fBdisabled\fR.
  147. This command is obsolete and will eventually be removed;
  148. use ``\fIpathName \fBconfigure \-state active\fR'' instead.
  149. .VE
  150. .TP
  151. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  152. Query or modify the configuration options of the widget.
  153. If no \fIoption\fR is specified, returns a list describing all of
  154. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  155. information on the format of this list).  If \fIoption\fR is specified
  156. with no \fIvalue\fR, then the command returns a list describing the
  157. one named option (this list will be identical to the corresponding
  158. sublist of the value returned if no \fIoption\fR is specified).  If
  159. one or more \fIoption\-value\fR pairs are specified, then the command
  160. modifies the given widget option(s) to have the given value(s);  in
  161. this case the command returns an empty string.
  162. \fIOption\fR may have any of the values accepted by the \fBbutton\fR
  163. command.
  164. .TP
  165. \fIpathName \fBdeactivate\fR
  166. Change the button's state to \fBnormal\fR and redisplay the button
  167. using its normal foreground and background colors.
  168. .VS
  169. This command is ignored if the button's state is \fBdisabled\fR.
  170. This command is obsolete and will eventually be removed;
  171. use ``\fIpathName \fBconfigure \-state normal\fR'' instead.
  172. .VE
  173. .TP
  174. \fIpathName \fBflash\fR
  175. Flash the button.  This is accomplished by redisplaying the button
  176. several times, alternating between active and normal colors.  At
  177. the end of the flash the button is left in the same normal/active
  178. state as when the command was invoked.
  179. .VS
  180. This command is ignored if the button's state is \fBdisabled\fR.
  181. .VE
  182. .TP
  183. \fIpathName \fBinvoke\fR
  184. .VS
  185. Invoke the Tcl command associated with the button, if there is one.
  186. The return value is the return value from the Tcl command, or an
  187. empty string if there is no command associated with the button.
  188. This command is ignored if the button's state is \fBdisabled\fR.
  189. .VE
  190.  
  191. .SH "DEFAULT BINDINGS"
  192. .PP
  193. .VS
  194. Tk automatically creates class bindings for buttons that give them
  195. the following default behavior:
  196. .IP [1]
  197. The button activates whenever the mouse passes over it and deactivates
  198. whenever the mouse leaves the button.
  199. .IP [2]
  200. The button's relief is changed to sunken whenever mouse button 1 is
  201. pressed over the button, and the relief is restored to its original
  202. value when button 1 is later released.
  203. .IP [3]
  204. If mouse button 1 is pressed over the button and later released over
  205. the button, the button is invoked.  However, if the mouse is not
  206. over the button when button 1 is released, then no invocation occurs.
  207. .PP
  208. If the button's state is \fBdisabled\fR then none of the above
  209. actions occur:  the button is completely non-responsive.
  210. .PP
  211. The behavior of buttons can be changed by defining new bindings for
  212. individual widgets or by redefining the class bindings.
  213. .VE
  214.  
  215. .SH KEYWORDS
  216. button, widget
  217.