Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / Button.pod
CommitLineData
86530b38
AT
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
10Tk::Button - Create and manipulate Button widgets
11
12=for category Tk Widget Classes
13
14=head1 SYNOPSIS
15
16I<$button> = I<$parent>-E<gt>B<Button>(?I<options>?);
17
18=head1 STANDARD OPTIONS
19
20B<-activebackground> B<-cursor> B<-highlightthickness> B<-takefocus>
21B<-activeforeground> B<-disabledforeground> B<-image> B<-text>
22B<-anchor> B<-font> B<-justify> B<-textvariable>
23B<-background> B<-foreground> B<-padx> B<-underline>
24B<-bitmap> B<-highlightbackground> B<-pady> B<-wraplength>
25B<-borderwidth> B<-highlightcolor> B<-relief>
26
27See 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
39Specifies a L<perl/Tk callback|Tk::callbacks> to associate with the button. This command
40is typically invoked when mouse button 1 is released over the button
41window.
42
43=item Name: B<default>
44
45=item Class: B<Default>
46
47=item Switch: B<-default>
48
49Specifies one of three states for the default ring: B<normal>,
50B<active>, or B<disabled>. In active state, the button is drawn
51with the platform specific appearance for a default button. In normal
52state, the button is drawn with the platform specific appearance for a
53non-default button, leaving enough space to draw the default button
54appearance. The normal and active states will result in buttons of
55the same size. In disabled state, the button is drawn with the
56non-default button appearance without leaving space for the default
57appearance. The disabled state may result in a smaller button than
58the active state.
59ring.
60
61=item Name: B<height>
62
63=item Class: B<Height>
64
65=item Switch: B<-height>
66
67Specifies a desired height for the button.
68If an image or bitmap is being displayed in the button then the value is in
69screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
70for text it is in lines of text.
71If this option isn't specified, the button's desired height is computed
72from the size of the image or bitmap or text being displayed in it.
73
74=item Name: B<state>
75
76=item Class: B<State>
77
78=item Switch: B<-state>
79
80Specifies one of three states for the button: B<normal>, B<active>,
81or B<disabled>. In normal state the button is displayed using the
82B<foreground> and B<background> options. The active state is
83typically used when the pointer is over the button. In active state
84the button is displayed using the B<activeForeground> and
85B<activeBackground> options. Disabled state means that the button
86should be insensitive: the default bindings will refuse to activate
87the widget and will ignore mouse button presses.
88In this state the B<disabledForeground> and
89B<background> options determine how the button is displayed.
90
91=item Name: B<width>
92
93=item Class: B<Width>
94
95=item Switch: B<-width>
96
97Specifies a desired width for the button.
98If an image or bitmap is being displayed in the button then the value is in
99screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
100for text it is in characters.
101If this option isn't specified, the button's desired width is computed
102from the size of the image or bitmap or text being displayed in it.
103
104=back
105
106=head1 DESCRIPTION
107
108The B<Button> method creates a new window (given by the
109$widget argument) and makes it into a button widget.
110Additional
111options, described above, may be specified on the command line
112or in the option database
113to configure aspects of the button such as its colors, font,
114text, and initial relief. The B<button> command returns its
115$widget argument. At the time this command is invoked,
116there must not exist a window named $widget, but
117$widget's parent must exist.
118
119A button is a widget that displays a textual string, bitmap or image.
120If text is displayed, it must all be in a single font, but it
121can occupy multiple lines on the screen (if it contains newlines
122or if wrapping occurs because of the B<-wraplength> option) and
123one of the characters may optionally be underlined using the
124B<-underline> option.
125It can display itself in either of three different ways, according
126to
127the B<-state> option;
128it can be made to appear raised, sunken, or flat;
129and it can be made to flash. When a user invokes the
130button (by pressing mouse button 1 with the cursor over the
131button), then the L<perl/Tk callback|Tk::callbacks> specified in the B<-command>
132option is invoked.
133
134=head1 WIDGET METHODS
135
136The B<Button> method creates a widget object.
137This object supports the B<configure> and B<cget> methods
138described in L<Tk::options> which can be used to enquire and
139modify the options described above.
140The widget also inherits all the methods provided by the generic
141L<Tk::Widget|Tk::Widget> class.
142
143The following additional methods are available for button widgets:
144
145=over 4
146
147=item I<$button>-E<gt>B<flash>
148
149Flash the button. This is accomplished by redisplaying the button
150several times, alternating between active and normal colors. At
151the end of the flash the button is left in the same normal/active
152state as when the command was invoked.
153This command is ignored if the button's state is B<disabled>.
154
155=item I<$button>-E<gt>B<invoke>
156
157Invoke the L<callback|Tk::callbacks> associated with the buttons
158B<-command> option, if there is one.
159The return value is the return value from the callback, or the
160undefined value if there is no callback associated with the button.
161This command is ignored if the button's state is B<disabled>.
162
163=back
164
165=head1 DEFAULT BINDINGS
166
167Tk automatically creates class bindings for buttons that give them
168default behavior:
169
170=over 4
171
172=item [1]
173
174A button activates whenever the mouse passes over it and deactivates
175whenever the mouse leaves the button.
176Under Windows, this binding is only active when mouse button 1 has
177been pressed over the button.
178
179=item [2]
180
181A button's relief is changed to sunken whenever mouse button 1 is
182pressed over the button, and the relief is restored to its original
183value when button 1 is later released.
184
185=item [3]
186
187If mouse button 1 is pressed over a button and later released over
188the button, the button is invoked. However, if the mouse is not
189over the button when button 1 is released, then no invocation occurs.
190
191=item [4]
192
193When a button has the input focus, the space key causes the button
194to be invoked.
195
196If the button's state is B<disabled> then none of the above
197actions occur: the button is completely non-responsive.
198
199The behavior of buttons can be changed by defining new bindings for
200individual widgets or by redefining the class bindings.
201
202=back
203
204=head1 KEYWORDS
205
206button, widget
207
208=cut
209