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 / Radiobutton.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::Radiobutton - Create and manipulate Radiobutton widgets
11
12=for category Tk Widget Classes
13
14=head1 SYNOPSIS
15
16I<$radiobutton> = I<$parent>-E<gt>B<Radiobutton>(?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. The button's global variable (B<-variable> option) will
42be updated before the command is invoked.
43
44=item Name: B<height>
45
46=item Class: B<Height>
47
48=item Switch: B<-height>
49
50Specifies a desired height for the button.
51If an image or bitmap is being displayed in the button then the value is in
52screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
53for text it is in lines of text.
54If this option isn't specified, the button's desired height is computed
55from the size of the image or bitmap or text being displayed in it.
56
57=item Name: B<indicatorOn>
58
59=item Class: B<IndicatorOn>
60
61=item Switch: B<-indicatoron>
62
63Specifies whether or not the indicator should be drawn. Must be a
64proper boolean value. If false, the B<relief> option is
65ignored and the widget's relief is always sunken if the widget is
66selected and raised otherwise.
67
68=item Name: B<selectColor>
69
70=item Class: B<Background>
71
72=item Switch: B<-selectcolor>
73
74Specifies a background color to use when the button is selected.
75If B<indicatorOn> is true then the color applies to the indicator.
76Under Windows, this color is used as the background for the indicator
77regardless of the select state.
78If B<indicatorOn> is false, this color is used as the background
79for the entire widget, in place of B<background> or B<activeBackground>,
80whenever the widget is selected.
81If specified as an empty string then no special color is used for
82displaying when the widget is selected.
83
84=item Name: B<selectImage>
85
86=item Class: B<SelectImage>
87
88=item Switch: B<-selectimage>
89
90Specifies an image to display (in place of the B<image> option)
91when the radiobutton is selected.
92This option is ignored unless the B<image> option has been
93specified.
94
95=item Name: B<state>
96
97=item Class: B<State>
98
99=item Switch: B<-state>
100
101Specifies one of three states for the radiobutton: B<normal>, B<active>,
102or B<disabled>. In normal state the radiobutton is displayed using the
103B<foreground> and B<background> options. The active state is
104typically used when the pointer is over the radiobutton. In active state
105the radiobutton is displayed using the B<activeForeground> and
106B<activeBackground> options. Disabled state means that the radiobutton
107should be insensitive: the default bindings will refuse to activate
108the widget and will ignore mouse button presses.
109In this state the B<disabledForeground> and
110B<background> options determine how the radiobutton is displayed.
111
112=item Name: B<value>
113
114=item Class: B<Value>
115
116=item Switch: B<-value>
117
118Specifies value to store in the button's associated variable whenever
119this button is selected.
120
121=item Name: B<variable>
122
123=item Class: B<Variable>
124
125=item Switch: B<-variable>
126
127Specifies reference to a variable to set whenever this button is
128selected. Changes in this variable also cause the button to select
129or deselect itself. Defaults to the value C<\$Tk::selectedButton>.
130
131=item Name: B<width>
132
133=item Class: B<Width>
134
135=item Switch: B<-width>
136
137Specifies a desired width for the button.
138If an image or bitmap is being displayed in the button, the value is in
139screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
140for text it is in characters.
141If this option isn't specified, the button's desired width is computed
142from the size of the image or bitmap or text being displayed in it.
143
144=back
145
146=head1 DESCRIPTION
147
148The B<Radiobutton> method creates a new window (given by the
149$widget argument) and makes it into a radiobutton widget.
150Additional
151options, described above, may be specified on the command line
152or in the option database
153to configure aspects of the radiobutton such as its colors, font,
154text, and initial relief. The B<radiobutton> command returns its
155$widget argument. At the time this command is invoked,
156there must not exist a window named $widget, but
157$widget's parent must exist.
158
159A radiobutton is a widget that displays a textual string, bitmap or image
160and a diamond or circle called an I<indicator>.
161If text is displayed, it must all be in a single font, but it
162can occupy multiple lines on the screen (if it contains newlines
163or if wrapping occurs because of the B<wrapLength> option) and
164one of the characters may optionally be underlined using the
165B<underline> option. A radiobutton has
166all of the behavior of a simple button: it can display itself in either
167of three different ways, according to the B<state> option;
168it can be made to appear
169raised, sunken, or flat; it can be made to flash; and it invokes
170a L<perl/Tk callback|Tk::callbacks> whenever mouse button 1 is clicked over the
171check button.
172
173In addition, radiobuttons can be I<selected>.
174If a radiobutton is selected, the indicator is normally
175drawn with a selected appearance, and
176a Tcl variable associated with the radiobutton is set to a particular
177value (normally 1).
178Under Unix, the indicator is drawn with a sunken relief and a special
179color. Under Windows, the indicator is drawn with a round mark inside.
180If the radiobutton is not selected, then the indicator is drawn with a
181deselected appearance, and the associated variable is
182set to a different value (typically 0).
183Under Unix, the indicator is drawn with a raised relief and no special
184color. Under Windows, the indicator is drawn without a round mark inside.
185Typically, several radiobuttons share a single variable and the
186value of the variable indicates which radiobutton is to be selected.
187When a radiobutton is selected it sets the value of the variable to
188indicate that fact; each radiobutton also monitors the value of
189the variable and automatically selects and deselects itself when the
190variable's value changes.
191By default the variable B<selectedButton>
192is used; its contents give the name of the button that is
193selected, or the empty string if no button associated with that
194variable is selected.
195The name of the variable for a radiobutton,
196plus the variable to be stored into it, may be modified with options
197on the command line or in the option database.
198Configuration options may also be used to modify the way the
199indicator is displayed (or whether it is displayed at all).
200By default a radiobutton is configured to select itself on button clicks.
201
202=head1 WIDGET METHODS
203
204The B<Radiobutton> method creates a widget object.
205This object supports the B<configure> and B<cget> methods
206described in L<Tk::options> which can be used to enquire and
207modify the options described above.
208The widget also inherits all the methods provided by the generic
209L<Tk::Widget|Tk::Widget> class.
210
211The following additional methods are available for radiobutton widgets:
212
213=over 4
214
215=item I<$radiobutton>-E<gt>B<deselect>
216
217Deselects the radiobutton and sets the associated variable to an
218empty string.
219If this radiobutton was not currently selected, the command has
220no effect.
221
222=item I<$radiobutton>-E<gt>B<flash>
223
224Flashes the radiobutton. This is accomplished by redisplaying the radiobutton
225several times, alternating between active and normal colors. At
226the end of the flash the radiobutton is left in the same normal/active
227state as when the command was invoked.
228This command is ignored if the radiobutton's state is B<disabled>.
229
230=item I<$radiobutton>-E<gt>B<invoke>
231
232Does just what would have happened if the user invoked the radiobutton
233with the mouse: selects the button and invokes
234its associated Tcl command, if there is one.
235The return value is the return value from the Tcl command, or an
236empty string if there is no command associated with the radiobutton.
237This command is ignored if the radiobutton's state is B<disabled>.
238
239=item I<$radiobutton>-E<gt>B<select>
240
241Selects the radiobutton and sets the associated variable to the
242value corresponding to this widget.
243
244=back
245
246=head1 BINDINGS
247
248Tk automatically creates class bindings for radiobuttons that give them
249the following default behavior:
250
251=over 4
252
253=item [1]
254
255On Unix systems, a radiobutton activates whenever the mouse passes
256over it and deactivates whenever the mouse leaves the radiobutton. On
257Mac and Windows systems, when mouse button 1 is pressed over a
258radiobutton, the button activates whenever the mouse pointer is inside
259the button, and deactivates whenever the mouse pointer leaves the
260button.
261
262=item [2]
263
264When mouse button 1 is pressed over a radiobutton it is invoked (it
265becomes selected and the command associated with the button is
266invoked, if there is one).
267
268=item [3]
269
270When a radiobutton has the input focus, the space key causes the radiobutton
271to be invoked.
272
273If the radiobutton's state is B<disabled> then none of the above
274actions occur: the radiobutton is completely non-responsive.
275
276The behavior of radiobuttons can be changed by defining new bindings for
277individual widgets or by redefining the class bindings.
278
279=back
280
281=head1 KEYWORDS
282
283radiobutton, widget
284
285=cut
286