home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Radiobutton - Create and manipulate Radiobutton widgets</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Radiobutton - Create and manipulate Radiobutton widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#standard options">STANDARD OPTIONS</A></LI>
- <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
- <LI><A HREF="#bindings">BINDINGS</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Radiobutton - Create and manipulate Radiobutton widgets</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P><EM>$radiobutton</EM> = <EM>$parent</EM>-><STRONG>Radiobutton</STRONG>(?<EM>options</EM>?);</P>
- <P>
- <HR>
- <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
- <P><TABLE CELLSPACING=0 CELLPADDING=0><TR><TD><STRONG>-activebackground</STRONG><TD><STRONG>-cursor</STRONG><TD><STRONG>-highlightthickness</STRONG><TD><STRONG>-takefocus</STRONG>
- <TR><TD><STRONG>-activeforeground</STRONG><TD><STRONG>-disabledforeground</STRONG><TD><STRONG>-image</STRONG><TD><STRONG>-text</STRONG>
- <TR><TD><STRONG>-anchor</STRONG><TD><STRONG>-font</STRONG><TD><STRONG>-justify</STRONG><TD><STRONG>-textvariable</STRONG>
- <TR><TD><STRONG>-background</STRONG><TD><STRONG>-foreground</STRONG><TD><STRONG>-padx</STRONG><TD><STRONG>-underline</STRONG>
- <TR><TD><STRONG>-bitmap</STRONG><TD><STRONG>-highlightbackground</STRONG><TD><STRONG>-pady</STRONG><TD><STRONG>-wraplength</STRONG>
- <TR><TD><STRONG>-borderwidth</STRONG><TD><STRONG>-highlightcolor</STRONG><TD><STRONG>-relief</STRONG></TABLE></P>
- <P>See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details of the standard options.</P>
- <P>
- <HR>
- <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_Name%3A_command">Name: <STRONG>command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Command">Class: <STRONG>Command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dcommand">Switch: <STRONG>-command</STRONG></A></STRONG><BR>
- <DD>
- Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">perl/Tk callback</A> to associate with the button. This command
- is typically invoked when mouse button 1 is released over the button
- window. The button's global variable (<STRONG>-variable</STRONG> option) will
- be updated before the command is invoked.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_height">Name: <STRONG>height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Height">Class: <STRONG>Height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dheight">Switch: <STRONG>-height</STRONG></A></STRONG><BR>
- <DD>
- Specifies a desired height for the button.
- If an image or bitmap is being displayed in the button then the value is in
- screen units (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>);
- for text it is in lines of text.
- If this option isn't specified, the button's desired height is computed
- from the size of the image or bitmap or text being displayed in it.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_indicatorOn">Name: <STRONG>indicatorOn</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_IndicatorOn">Class: <STRONG>IndicatorOn</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dindicatoron">Switch: <STRONG>-indicatoron</STRONG></A></STRONG><BR>
- <DD>
- Specifies whether or not the indicator should be drawn. Must be a
- proper boolean value. If false, the <STRONG>relief</STRONG> option is
- ignored and the widget's relief is always sunken if the widget is
- selected and raised otherwise.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_selectColor">Name: <STRONG>selectColor</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Background">Class: <STRONG>Background</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dselectcolor">Switch: <STRONG>-selectcolor</STRONG></A></STRONG><BR>
- <DD>
- Specifies a background color to use when the button is selected.
- If <STRONG>indicatorOn</STRONG> is true then the color applies to the indicator.
- Under Windows, this color is used as the background for the indicator
- regardless of the select state.
- If <STRONG>indicatorOn</STRONG> is false, this color is used as the background
- for the entire widget, in place of <STRONG>background</STRONG> or <STRONG>activeBackground</STRONG>,
- whenever the widget is selected.
- If specified as an empty string then no special color is used for
- displaying when the widget is selected.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_selectImage">Name: <STRONG>selectImage</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_SelectImage">Class: <STRONG>SelectImage</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dselectimage">Switch: <STRONG>-selectimage</STRONG></A></STRONG><BR>
- <DD>
- Specifies an image to display (in place of the <STRONG>image</STRONG> option)
- when the radiobutton is selected.
- This option is ignored unless the <STRONG>image</STRONG> option has been
- specified.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_state">Name: <STRONG>state</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_State">Class: <STRONG>State</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dstate">Switch: <STRONG>-state</STRONG></A></STRONG><BR>
- <DD>
- Specifies one of three states for the radiobutton: <STRONG>normal</STRONG>, <STRONG>active</STRONG>,
- or <STRONG>disabled</STRONG>. In normal state the radiobutton is displayed using the
- <STRONG>foreground</STRONG> and <STRONG>background</STRONG> options. The active state is
- typically used when the pointer is over the radiobutton. In active state
- the radiobutton is displayed using the <STRONG>activeForeground</STRONG> and
- <STRONG>activeBackground</STRONG> options. Disabled state means that the radiobutton
- should be insensitive: the default bindings will refuse to activate
- the widget and will ignore mouse button presses.
- In this state the <STRONG>disabledForeground</STRONG> and
- <STRONG>background</STRONG> options determine how the radiobutton is displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_value">Name: <STRONG>value</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Value">Class: <STRONG>Value</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dvalue">Switch: <STRONG>-value</STRONG></A></STRONG><BR>
- <DD>
- Specifies value to store in the button's associated variable whenever
- this button is selected.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_variable">Name: <STRONG>variable</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Variable">Class: <STRONG>Variable</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dvariable">Switch: <STRONG>-variable</STRONG></A></STRONG><BR>
- <DD>
- Specifies reference to a variable to set whenever this button is
- selected. Changes in this variable also cause the button to select
- or deselect itself. Defaults to the value <CODE>\$Tk::selectedButton</CODE>.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_width">Name: <STRONG>width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Width">Class: <STRONG>Width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dwidth">Switch: <STRONG>-width</STRONG></A></STRONG><BR>
- <DD>
- Specifies a desired width for the button.
- If an image or bitmap is being displayed in the button, the value is in
- screen units (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>);
- for text it is in characters.
- If this option isn't specified, the button's desired width is computed
- from the size of the image or bitmap or text being displayed in it.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Radiobutton</STRONG> method creates a new window (given by the
- $widget argument) and makes it into a radiobutton widget.
- Additional
- options, described above, may be specified on the command line
- or in the option database
- to configure aspects of the radiobutton such as its colors, font,
- text, and initial relief. The <STRONG>radiobutton</STRONG> command returns its
- $widget argument. At the time this command is invoked,
- there must not exist a window named $widget, but
- $widget's parent must exist.</P>
- <P>A radiobutton is a widget that displays a textual string, bitmap or image
- and a diamond or circle called an <EM>indicator</EM>.
- If text is displayed, it must all be in a single font, but it
- can occupy multiple lines on the screen (if it contains newlines
- or if wrapping occurs because of the <STRONG>wrapLength</STRONG> option) and
- one of the characters may optionally be underlined using the
- <STRONG>underline</STRONG> option. A radiobutton has
- all of the behavior of a simple button: it can display itself in either
- of three different ways, according to the <STRONG>state</STRONG> option;
- it can be made to appear
- raised, sunken, or flat; it can be made to flash; and it invokes
- a <A HREF="../../../site/lib/Tk/callbacks.html">perl/Tk callback</A> whenever mouse button 1 is clicked over the
- check button.</P>
- <P>In addition, radiobuttons can be <EM>selected</EM>.
- If a radiobutton is selected, the indicator is normally
- drawn with a selected appearance, and
- a Tcl variable associated with the radiobutton is set to a particular
- value (normally 1).
- Under Unix, the indicator is drawn with a sunken relief and a special
- color. Under Windows, the indicator is drawn with a round mark inside.
- If the radiobutton is not selected, then the indicator is drawn with a
- deselected appearance, and the associated variable is
- set to a different value (typically 0).
- Under Unix, the indicator is drawn with a raised relief and no special
- color. Under Windows, the indicator is drawn without a round mark inside.
- Typically, several radiobuttons share a single variable and the
- value of the variable indicates which radiobutton is to be selected.
- When a radiobutton is selected it sets the value of the variable to
- indicate that fact; each radiobutton also monitors the value of
- the variable and automatically selects and deselects itself when the
- variable's value changes.
- By default the variable <STRONG>selectedButton</STRONG>
- is used; its contents give the name of the button that is
- selected, or the empty string if no button associated with that
- variable is selected.
- The name of the variable for a radiobutton,
- plus the variable to be stored into it, may be modified with options
- on the command line or in the option database.
- Configuration options may also be used to modify the way the
- indicator is displayed (or whether it is displayed at all).
- By default a radiobutton is configured to select itself on button clicks.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Radiobutton</STRONG> method creates a widget object.
- This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
- described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
- modify the options described above.
- The widget also inherits all the methods provided by the generic
- <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
- <P>The following additional methods are available for radiobutton widgets:</P>
- <DL>
- <DT><STRONG><A NAME="item_deselect"><EM>$radiobutton</EM>-><STRONG>deselect</STRONG></A></STRONG><BR>
- <DD>
- Deselects the radiobutton and sets the associated variable to an
- empty string.
- If this radiobutton was not currently selected, the command has
- no effect.
- <P></P>
- <DT><STRONG><A NAME="item_flash"><EM>$radiobutton</EM>-><STRONG>flash</STRONG></A></STRONG><BR>
- <DD>
- Flashes the radiobutton. This is accomplished by redisplaying the radiobutton
- several times, alternating between active and normal colors. At
- the end of the flash the radiobutton is left in the same normal/active
- state as when the command was invoked.
- This command is ignored if the radiobutton's state is <STRONG>disabled</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_invoke"><EM>$radiobutton</EM>-><STRONG>invoke</STRONG></A></STRONG><BR>
- <DD>
- Does just what would have happened if the user invoked the radiobutton
- with the mouse: selects the button and invokes
- its associated Tcl command, if there is one.
- The return value is the return value from the Tcl command, or an
- empty string if there is no command associated with the radiobutton.
- This command is ignored if the radiobutton's state is <STRONG>disabled</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_select"><EM>$radiobutton</EM>-><STRONG>select</STRONG></A></STRONG><BR>
- <DD>
- Selects the radiobutton and sets the associated variable to the
- value corresponding to this widget.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="bindings">BINDINGS</A></H1>
- <P>Tk automatically creates class bindings for radiobuttons that give them
- the following default behavior:</P>
- <DL>
- <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
- <DD>
- On Unix systems, a radiobutton activates whenever the mouse passes
- over it and deactivates whenever the mouse leaves the radiobutton. On
- Mac and Windows systems, when mouse button 1 is pressed over a
- radiobutton, the button activates whenever the mouse pointer is inside
- the button, and deactivates whenever the mouse pointer leaves the
- button.
- <P></P>
- <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
- <DD>
- When mouse button 1 is pressed over a radiobutton it is invoked (it
- becomes selected and the command associated with the button is
- invoked, if there is one).
- <P></P>
- <DT><STRONG><A NAME="item_%5B3%5D">[3]</A></STRONG><BR>
- <DD>
- When a radiobutton has the input focus, the space key causes the radiobutton
- to be invoked.
- <P>If the radiobutton's state is <STRONG>disabled</STRONG> then none of the above
- actions occur: the radiobutton is completely non-responsive.</P>
- <P>The behavior of radiobuttons can be changed by defining new bindings for
- individual widgets or by redefining the class bindings.</P>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>radiobutton, widget</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Radiobutton - Create and manipulate Radiobutton widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-