<section ID="chapter.widgets.checkbutton">
  <TITLE>Checkbutton widget</TITLE>

<subsection> <TITLE>Description</TITLE>

<P>
A checkbutton is a widget that displays a textual string, bitmap or image and a square called an
indicator. 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 <<wraplength>> option) and one of the characters may optionally be underlined using the underline 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 state option; it can be made to appear raised, sunken, or flat; it can be made to flash; and it invokes an Oz command whenever mouse button 1 is clicked over the checkbutton. 
</P>
<P>
In addition, checkbuttons can be selected. If a checkbutton is selected then the indicator is normally drawn with a selected appearance. 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. 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. Configuration options may 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.
</P>

<subsection> <TITLE>Parameters</TITLE>

<P>
<LIST>
<ITEM> <<1:B>> : Specifies if the checkbutton is selected or not. <<B>> must be a boolean. This parameter can be only used with the <<set()>> and <<get()>> methods.

<ITEM> <<init:B>> : Specifies if the checkbutton is selected or not. <<B>> must be a boolean. This parameter can be only used at creation time.

<ITEM> <<return:V>> : When the window is closed, <<B>> is bound to true if the checkbutton is selected, false otherwise. <<V>> must be a free variable.

&param_activebackground;
&param_activeforeground;
&param_anchor;
&param_background;
&param_bitmap;
&param_borderwidth;
&param_cursor;
&param_disabledforeground;
&param_font;
&param_foreground;
&param_highlightbackground;
&param_highlightcolor;
&param_highlightthickness;
&param_image;
&param_justify;
&param_relief;
&param_takefocus;
&param_text;
&param_underline;
&param_wraplength;

<ITEM> <<height:P>> : 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; 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>> must be a valid screen distance (see  <ptr to="misc.distance">).

<ITEM> <<indicatoron:B>> : Specifies whether or not the indicator should be drawn. If <<false>>, the relief option is ignored and the widget's relief is always sunken if the widget is selected and raised otherwise. <<B>> must be a boolean.

<ITEM> <<selectcolor:C>> : Specifies a background color to use when the button is selected. If <<indicatoron>> 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 <<indicatoron>> is false, this color is used as the background for the entire widget, in place of <<background>> or <<activebackground>>, whenever the widget is selected. <<C>> must be a valid color (see <ptr to="misc.color">).

<ITEM> <<selectimage:I>> : Specifies an image to display (in place of the <<image>> option) when the checkbutton is selected. This option is ignored unless the <<image>> option has been specified. <<I>> must be a valid image (see <ptr to="misc.image">)

<ITEM> <<state:A>> : Specifies one of three states for the button: <<normal>>, <<active>>, or <<disabled>>. In normal state the button is
    displayed using the foreground and background options. The active state is typically used when the
    pointer is over the button. In active state the button is displayed using the activeforeground and
    activebackground options. Disabled state means that the button should be insensitive: the default
    bindings will refuse to activate the widget and will ignore mouse button presses. In this state the
    disabledforeground and background options determine how the button is displayed. <<A>> must be one of these three atoms : <<normal>>, <<active>>, or <<disabled>>.

<ITEM> <<width:P>> : Specifies a desired width for the checkbutton. If an image or bitmap is being displayed in the button then the
    value is in screen units; 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>> must be a valid screen distance (see  <ptr to="misc.distance">).


&param_ipadx;
&param_ipady;

<ITEM> <<action:C>> : Specifies an action to execute juste after the user clicked the checkbutton. <<C>> can take several different forms (see <ptr to="basics.events">).

&param_glue;
&param_padx;
&param_pady;
&param_feature;
&param_handle;
&param_tooltips;


</LIST>

</P>

<subsection> <TITLE>Interface</TITLE>

<P>
The object you get by an handle on the widget implements the following methods :

<LIST>

&interface_set;
&interface_get;
&interface_bind;
&interface_getFocus;
&interface_setGrab;
&interface_releaseGrab;
&interface_getGrabStatus;
&interface_raise;
&interface_lower;
&interface_winfo;

<ITEM> <<flash>> : 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 disabled. 


</LIST>

</section>
