Bwidget Source Code
Artifact [6d82d8788e]
Not logged in

Artifact 6d82d8788ecc64ad304dbf4395e5d33438c511fa:


<HTML>
<HEAD><TITLE>Button</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Button</B>
 - Button widget with enhanced options
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Button</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activebackground">-activebackground</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activeforeground">-activeforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
</TD>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-bitmap">-bitmap</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-cursor">-cursor</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-disabledforeground">-disabledforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-font">-font</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-foreground">-foreground or -fg</A></TD>
</TD>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightbackground">-highlightbackground</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightcolor">-highlightcolor</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightthickness">-highlightthickness</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-image">-image</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-padx">-padx</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-pady">-pady</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatdelay">-repeatdelay</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatinterval">-repeatinterval</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TD>
</TABLE></DD>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-compound">-compound</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-cursor">-cursor</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-image">-image</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-style">-style</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatdelay">-repeatdelay</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatinterval">-repeatinterval</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-armcommand">-armcommand</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-command">-command</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-default">-default</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-disarmcommand">-disarmcommand</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-helptext">-helptext</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-helptype">-helptype</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-helpvar">-helpvar</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-name">-name</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-relief">-relief</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-state">-state</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-underline">-underline</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TD>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#cget"><B>cget</B></A>
 <I>option</I>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD><I>pathName</I> <A HREF="#invoke"><B>invoke</B></A>
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

Button widget extends the Tk button with new options.
<A HREF="DynamicHelp.html">DynamicHelp</A> options,
a new relief style, callback for <B>arm</B>/<B>disarm</B>, and
<B>repeatdelay</B>/<B>repeatinterval</B> options has been added.
</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-armcommand"><B>-armcommand</B></A></DT>
<DD>

Specifies a Tcl command to associate with the Button when mouse button 1 is pressed over the
Button. When <B>repeatdelay</B> or <B>repeatinterval</B> option is positive integer,
this command is repeatedly called if mouse pointer is over the Button and until mouse
button 1 is released.
</DD>
</DL>
<DL><DT><A NAME="-command"><B>-command</B></A></DT>
<DD>

Specifies a Tcl command to associate with the Button.  This command
is typically invoked when mouse button 1 is released over the Button
window.
</DD>
</DL>
<DL><DT><A NAME="-default"><B>-default</B></A></DT>
<DD>

Specifies one of three states for the default ring: <B>normal</B>, <B>active</B>,
or <B>disabled</B>. In active state, the button is drawn with the platform specific
appearance for a default button. In normal state, the button is drawn with the platform
specific appearance for a non-default button, leaving enough space to draw the default
button appearance. The normal and active states will result in buttons of the same size.
In disabled state, the button is drawn with the non-default button appearance without
leaving space for the default appearance. The disabled state may result
in a smaller button than the active state.
</DD>
</DL>
<DL><DT><A NAME="-disarmcommand"><B>-disarmcommand</B></A></DT>
<DD>

Specifies a Tcl command to associate with the Button when mouse button 1 is released.
This command is called even if pointer is not over the Button, and always before
the command specified by <B>command</B> option.
It is typically used in conjuntion with <B>armcommand</B>, <B>repeatdelay</B> and
<B>repeatinterval</B>.
</DD>
</DL>
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<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;
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.<BR>
Option not available when widget is <I>themed</I>.
</DD>
</DL>
<DL><DT><A NAME="-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this widget.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.
</DD>
</DL>
<DL><DT><A NAME="-helptype"><B>-helptype</B></A></DT>
<DD>
Type of dynamic help. Use <I>balloon</I> or <I>variable</I>.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.
</DD>
</DL>
<DL><DT><A NAME="-helpvar"><B>-helpvar</B></A></DT>
<DD>
Variable to use when <B>helptype</B> option is <I>variable</I>.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.
</DD>
</DL>
<DL><DT><A NAME="-name"><B>-name</B></A></DT>
<DD>

Specifies a standard name for the button. If the option <B>*<I>name</I>Name</B> is
found in the resources database, then <B>text</B> and <B>underline</B> options
are extracted from its value.

</DD>
</DL>
<DL><DT><A NAME="-relief"><B>-relief</B></A></DT>
<DD>

Specifies the 3-D effect desired for the widget. Acceptable values are standard values for
button relief (<B>raised</B>, <B>sunken</B>, <B>flat</B>, <B>ridge</B>, <B>solid</B>, and <B>groove</B>) and <B>link</B>, which specifies that button relief is <B>flat</B> when pointer
is outside the button and <B>raised</B> when pointer is inside.<BR>
This option has only the following effect if the widget is <I>themed</I>:
The value <B>link</B> used a style <B>Toolbutton</B> while any other value uses the standard effect.
</DD>
</DL>
<DL><DT><A NAME="-state"><B>-state</B></A></DT>
<DD>

Specifies one of three states for the Button:  <B>normal</B>, <B>active</B>,
or <B>disabled</B>.  In normal state the Button is displayed using the
<B>foreground</B> and <B>background</B> options.  The active state is
typically used when the pointer is over the Button.  In active state
the Button is displayed using the <B>activeforeground</B> and
<B>activebackground</B> 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 <B>disabledforeground</B> and
<B>background</B> options determine how the Button is displayed.
</DD>
</DL>
<DL><DT><A NAME="-underline"><B>-underline</B></A></DT>
<DD>

Specifies the integer index of a character to underline in the label of the button.
0 corresponds to the first character of the text displayed, 1 to the next character,
and so on.
<BR>The binding <B>&lt;Alt-<I>char</I>&gt;</B> is automatically set on the toplevel
of the Button to call Button::<B>setfocus</B>.

</DD>
</DL>
<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>

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.
</DD>
</DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="cget"><I>pathName</I> <B>cget</B></A>
 <I>option</I>
</DT><DD>

Returns the current value of the configuration option given by <I>option</I>.
<I>Option</I> may have any of the values accepted by the creation command.
</DD></DL>
<DL><DT><A NAME="configure"><I>pathName</I> <B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DT><DD>

Query or modify the configuration options of the widget. If no <I>option</I> is specified,
returns a list describing all of the available options for <I>pathName</I>.
If <I>option</I> is specified with no <I>value</I>, then the command returns a list
describing the one named <I>option</I> (this list will be identical to the corresponding
sublist of the value returned if no <I>option</I> is specified). If one or
more <I>option-value</I> pairs are specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the command returns an empty string.
<I>Option</I> may have any of the values accepted by the creation command.
Read-only options are not be modified.

</DD></DL>
<DL><DT><A NAME="invoke"><I>pathName</I> <B>invoke</B></A>
</DT><DD>

If Button <B>state</B> is not disabled, this invoke the commands of the Button.
Button is redisplayed with active color and sunken relief, and
<B>armcommand</B> is called. Then Button is redisplayed with
normal color and its defined relief, and <B>disarmcommand</B> then <B>command</B>
are called.
<P><B>invoke</B> is called when Button has input focus and user press the space bar.

</DD></DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">BINDINGS</A></B><BR>
<DL><DT><A NAME="Invoke"><I>&lt;&lt;Invoke&gt;&gt;</I></A>
</DT><DD>

Invoke the <B>invoke</B> widget command.
</DD></DL>
<HR WIDTH="50%"><BR>
</BODY></HTML>