home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _84278cc6a440c73e3194c451b232bd83 < prev    next >
Encoding:
Text File  |  2004-06-01  |  7.8 KB  |  236 lines

  1. #  Copyright (c) 1990-1994 The Regents of the University of California.
  2. #  Copyright (c) 1994-1996 Sun Microsystems, Inc.
  3. #  See the file "license.terms" for information on usage and redistribution
  4. #  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  5. #
  6. #
  7.  
  8. =head1 NAME
  9.  
  10. Tk::Button - Create and manipulate Button widgets
  11.  
  12. =for category  Tk Widget Classes
  13.  
  14. =head1 SYNOPSIS
  15.  
  16. I<$button> = I<$parent>-E<gt>B<Button>(?I<options>?);
  17.  
  18. =head1 STANDARD OPTIONS
  19.  
  20. B<-activebackground>    B<-cursor>    B<-highlightthickness>    B<-takefocus>
  21. B<-activeforeground>    B<-disabledforeground>    B<-image>    B<-text>
  22. B<-anchor>    B<-font>    B<-justify>    B<-textvariable>
  23. B<-background>    B<-foreground>    B<-padx>    B<-underline>
  24. B<-bitmap>    B<-highlightbackground>    B<-pady>    B<-wraplength>
  25. B<-borderwidth>    B<-highlightcolor>    B<-relief>
  26.  
  27. See L<Tk::options> for details of the standard options.
  28.  
  29. =head1 WIDGET-SPECIFIC OPTIONS
  30.  
  31. =over 4
  32.  
  33. =item Name:    B<command>
  34.  
  35. =item Class:    B<Command>
  36.  
  37. =item Switch:    B<-command>
  38.  
  39. Specifies a L<Perl/Tk callback|Tk::callbacks> to associate with the
  40. button.  This command is typically invoked when mouse button 1 is
  41. released over the button window.
  42.  
  43. =item Command-Line Name: B<-compound>
  44.  
  45. =item Database Name:  B<compound>
  46.  
  47. =item Database Class: B<Compound>
  48.  
  49. Specifies whether the button should display both an image and text,
  50. and if so, where the image should be placed relative to the text.
  51. Valid values for this option are B<bottom>, B<center>, B<left>,
  52. B<none>, B<right> and B<top>.  The default value is B<none>, meaning
  53. that the button will display either an image or text, depending on the
  54. values of the -image and -bitmap options.
  55.  
  56. =item Name:    B<default>
  57.  
  58. =item Class:    B<Default>
  59.  
  60. =item Switch:    B<-default>
  61.  
  62. Specifies one of three states for the default ring: B<normal>,
  63. B<active>, or B<disabled>.  In active state, the button is drawn
  64. with the platform specific appearance for a default button.  In normal
  65. state, the button is drawn with the platform specific appearance for a
  66. non-default button, leaving enough space to draw the default button
  67. appearance.  The normal and active states will result in buttons of
  68. the same size.  In disabled state, the button is drawn with the
  69. non-default button appearance without leaving space for the default
  70. appearance.  The disabled state may result in a smaller button than
  71. the active state.
  72. ring.
  73.  
  74. =item Name:    B<height>
  75.  
  76. =item Class:    B<Height>
  77.  
  78. =item Switch:    B<-height>
  79.  
  80. Specifies a desired height for the button.
  81. If an image or bitmap is being displayed in the button then the value is in
  82. screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
  83. for text it is in lines of text.
  84. If this option isn't specified, the button's desired height is computed
  85. from the size of the image or bitmap or text being displayed in it.
  86.  
  87. =item Command-Line Name: B<-overrelief>
  88.  
  89. =item Database Name:  B<overRelief>
  90.  
  91. =item Database Class: B<OverRelief>
  92.  
  93. Specifies  an alternative relief for the button, to be used when
  94. the mouse cursor is over the widget.  This option can be used to
  95. make  toolbar  buttons,  by configuring B<-relief flat -overrelief
  96. raised>.  If the value of this option is the empty  string,  then
  97. no  alternative relief is used when the mouse cursor is over the
  98. button.  The empty string is the default value.
  99.  
  100. =item Name:    B<state>
  101.  
  102. =item Class:    B<State>
  103.  
  104. =item Switch:    B<-state>
  105.  
  106. Specifies one of three states for the button:  B<normal>, B<active>,
  107. or B<disabled>.  In normal state the button is displayed using the
  108. B<foreground> and B<background> options.  The active state is
  109. typically used when the pointer is over the button.  In active state
  110. the button is displayed using the B<activeForeground> and
  111. B<activeBackground> options.  Disabled state means that the button
  112. should be insensitive:  the default bindings will refuse to activate
  113. the widget and will ignore mouse button presses.
  114. In this state the B<disabledForeground> and
  115. B<background> options determine how the button is displayed.
  116.  
  117. =item Name:    B<width>
  118.  
  119. =item Class:    B<Width>
  120.  
  121. =item Switch:    B<-width>
  122.  
  123. Specifies a desired width for the button.
  124. If an image or bitmap is being displayed in the button then the value is in
  125. screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
  126. for text it is in characters.
  127. If this option isn't specified, the button's desired width is computed
  128. from the size of the image or bitmap or text being displayed in it.
  129.  
  130. =back
  131.  
  132. =head1 DESCRIPTION
  133.  
  134. The B<Button> method creates a new window (given by the
  135. $widget argument) and makes it into a button widget.
  136. Additional
  137. options, described above, may be specified on the command line
  138. or in the option database
  139. to configure aspects of the button such as its colors, font,
  140. text, and initial relief.  The B<button> command returns its
  141. $widget argument.  At the time this command is invoked,
  142. there must not exist a window named $widget, but
  143. $widget's parent must exist.
  144.  
  145. A button is a widget that displays a textual string, bitmap or image.
  146. If text is displayed, it must all be in a single font, but it
  147. can occupy multiple lines on the screen (if it contains newlines
  148. or if wrapping occurs because of the B<-wraplength> option) and
  149. one of the characters may optionally be underlined using the
  150. B<-underline> option.
  151. It can display itself in either of three different ways, according
  152. to
  153. the B<-state> option;
  154. it can be made to appear raised, sunken, or flat;
  155. and it can be made to flash.  When a user invokes the
  156. button (by pressing mouse button 1 with the cursor over the
  157. button), then the L<perl/Tk callback|Tk::callbacks> specified in the B<-command>
  158. option is invoked.
  159.  
  160. =head1 WIDGET METHODS
  161.  
  162. The B<Button> method creates a widget object.
  163. This object supports the B<configure> and B<cget> methods
  164. described in L<Tk::options> which can be used to enquire and
  165. modify the options described above.
  166. The widget also inherits all the methods provided by the generic
  167. L<Tk::Widget|Tk::Widget> class.
  168.  
  169. The following additional methods are available for button widgets:
  170.  
  171. =over 4
  172.  
  173. =item I<$button>-E<gt>B<flash>
  174.  
  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. This command is ignored if the button's state is B<disabled>.
  180.  
  181. =item I<$button>-E<gt>B<invoke>
  182.  
  183. Invoke the L<callback|Tk::callbacks> associated with the buttons
  184. B<-command> option, if there is one.
  185. The return value is the return value from the callback, or the
  186. undefined value if there is no callback associated with the button.
  187. This command is ignored if the button's state is B<disabled>.
  188.  
  189. =back
  190.  
  191. =head1 DEFAULT BINDINGS
  192.  
  193. Tk automatically creates class bindings for buttons that give them
  194. default behavior:
  195.  
  196. =over 4
  197.  
  198. =item [1]
  199.  
  200. A button activates whenever the mouse passes over it and deactivates
  201. whenever the mouse leaves the button.
  202. Under Windows, this binding is only active when mouse button 1 has
  203. been pressed over the button.
  204.  
  205. =item [2]
  206.  
  207. A button's relief is changed to sunken whenever mouse button 1 is
  208. pressed over the button, and the relief is restored to its original
  209. value when button 1 is later released.
  210.  
  211. =item [3]
  212.  
  213. If mouse button 1 is pressed over a button and later released over
  214. the button, the button is invoked.  However, if the mouse is not
  215. over the button when button 1 is released, then no invocation occurs.
  216.  
  217. =item [4]
  218.  
  219. When a button has the input focus, the space key causes the button
  220. to be invoked.
  221.  
  222. If the button's state is B<disabled> then none of the above
  223. actions occur:  the button is completely non-responsive.
  224.  
  225. The behavior of buttons can be changed by defining new bindings for
  226. individual widgets or by redefining the class bindings.
  227.  
  228. =back
  229.  
  230. =head1 KEYWORDS
  231.  
  232. button, widget
  233.  
  234. =cut
  235.  
  236.