home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Checkbutton - Create and manipulate Checkbutton 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::Checkbutton - Create and manipulate Checkbutton 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::Checkbutton - Create and manipulate Checkbutton 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>$checkbutton</EM> = <EM>$parent</EM>-><STRONG>Checkbutton</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_offValue">Name: <STRONG>offValue</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_%2Doffvalue">Switch: <STRONG>-offvalue</STRONG></A></STRONG><BR>
- <DD>
- Specifies value to store in the button's associated variable whenever
- this button is deselected. Defaults to ``0''.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_onValue">Name: <STRONG>onValue</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG>Class: <STRONG>Value</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Donvalue">Switch: <STRONG>-onvalue</STRONG></A></STRONG><BR>
- <DD>
- Specifies value to store in the button's associated variable whenever
- this button is selected. Defaults to ``1''.
- <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 checkbutton 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 checkbutton: <STRONG>normal</STRONG>, <STRONG>active</STRONG>,
- or <STRONG>disabled</STRONG>. In normal state the checkbutton is displayed using the
- <STRONG>foreground</STRONG> and <STRONG>background</STRONG> options. The active state is
- typically used when the pointer is over the checkbutton. In active state
- the checkbutton is displayed using the <STRONG>activeForeground</STRONG> and
- <STRONG>activeBackground</STRONG> options. Disabled state means that the checkbutton
- 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 checkbutton is displayed.
- <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 to indicate whether
- or not this button is selected. Defaults to <CODE>\$widget->{'Value'}</CODE>
- member of the widget's hash. In general perl variables are <A HREF="../../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> unless
- specifically initialized which will not match either default <STRONG>-onvalue</STRONG> or
- deafult <STRONG>-offvalue</STRONG>.
- <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 then 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>Checkbutton</STRONG> method creates a new window (given by the
- $widget argument) and makes it into a checkbutton widget.
- Additional
- options, described above, may be specified on the command line
- or in the option database
- to configure aspects of the checkbutton such as its colors, font,
- text, and initial relief. The <STRONG>checkbutton</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 checkbutton is a widget
- that displays a textual string, bitmap or image
- and a square 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 checkbutton has
- all of the behavior of a simple button, including the
- following: 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
- checkbutton.</P>
- <P>In addition, checkbuttons can be <EM>selected</EM>.
- If a checkbutton is selected then the indicator is normally
- drawn with a selected appearance, and
- a Tcl variable associated with the checkbutton 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 check mark inside.
- If the checkbutton 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 check mark inside.
- By default, the name of the variable associated with a checkbutton is the
- same as the <EM>name</EM> used to create the checkbutton.
- The variable name, and the ``on'' and ``off'' values stored in 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 checkbutton is configured to select and deselect
- itself on alternate button clicks.
- In addition, each checkbutton monitors its associated variable and
- automatically selects and deselects itself when the variables value
- changes to and from the button's ``on'' value.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Checkbutton</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 checkbutton widgets:</P>
- <DL>
- <DT><STRONG><A NAME="item_deselect"><EM>$checkbutton</EM>-><STRONG>deselect</STRONG></A></STRONG><BR>
- <DD>
- Deselects the checkbutton and sets the associated variable to its ``off''
- value.
- <P></P>
- <DT><STRONG><A NAME="item_flash"><EM>$checkbutton</EM>-><STRONG>flash</STRONG></A></STRONG><BR>
- <DD>
- Flashes the checkbutton. This is accomplished by redisplaying the checkbutton
- several times, alternating between active and normal colors. At
- the end of the flash the checkbutton is left in the same normal/active
- state as when the command was invoked.
- This command is ignored if the checkbutton's state is <STRONG>disabled</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_invoke"><EM>$checkbutton</EM>-><STRONG>invoke</STRONG></A></STRONG><BR>
- <DD>
- Does just what would have happened if the user invoked the checkbutton
- with the mouse: toggle the selection state of the button and invoke
- the <A HREF="../../../site/lib/Tk/callbacks.html">perl/Tk callback</A> associated with the checkbutton, if there is one.
- The return value is the return value from the <A HREF="../../../site/lib/Tk/callbacks.html">perl/Tk callback</A>, or an
- empty string if there is no command associated with the checkbutton.
- This command is ignored if the checkbutton's state is <STRONG>disabled</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_select"><EM>$checkbutton</EM>-><STRONG>select</STRONG></A></STRONG><BR>
- <DD>
- Selects the checkbutton and sets the associated variable to its ``on''
- value.
- <P></P>
- <DT><STRONG><A NAME="item_toggle"><EM>$checkbutton</EM>-><STRONG>toggle</STRONG></A></STRONG><BR>
- <DD>
- Toggles the selection state of the button, redisplaying it and
- modifying its associated variable to reflect the new state.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="bindings">BINDINGS</A></H1>
- <P>Tk automatically creates class bindings for checkbuttons 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 checkbutton activates whenever the mouse passes
- over it and deactivates whenever the mouse leaves the checkbutton. On
- Mac and Windows systems, when mouse button 1 is pressed over a
- checkbutton, 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 checkbutton, it is invoked (its
- selection state toggles 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 checkbutton has the input focus, the space key causes the checkbutton
- to be invoked. Under Windows, there are additional key bindings; plus
- (+) and equal (=) select the button, and minus (-) deselects the button.
- <P>If the checkbutton's state is <STRONG>disabled</STRONG> then none of the above
- actions occur: the checkbutton is completely non-responsive.</P>
- <P>The behavior of checkbuttons 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>checkbutton, 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::Checkbutton - Create and manipulate Checkbutton widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-