<manpage cat="stdopt" id="widget" title="widget" version="0.2">
<!-- This file was automatically generated.  DO NOT EDIT (yet)! -->
<!-- 
     Copyright (c) 2004 Joe English
     widget.n,v 1.15 2007/12/12 15:55:15 jenglish Exp
 -->
<?TROFF.TH title="widget" section="n" date="0.2" source="tile" manual="Tile Widget Set" ?>
<namesection>
<name>widget</name>
<desc>Standard options and commands supported by Tile widgets</desc>
</namesection>
<section>
<title>DESCRIPTION</title>
<p>This manual describes common widget options and commands.
</p>
</section>
<section>
<title>STANDARD OPTIONS</title>
<p>The following options are supported by all Tile widgets:
</p>
<optionlist cat="stdopt" scope="global">
<optiondef>
<name>-class</name>
<dbname>(N/A)</dbname>
<dbclass>(N/A)</dbclass>
<desc>Specifies the window class.
The class is used when querying the option database 
for the window's other options, to determine the default
bindtags for the window, and to select the widget's default
layout and style.
This is a read-only option: 
it may only be specified when the window is created,
and may not be changed with the <b>configure</b> widget command.
</desc>
</optiondef>
<optiondef>
<name>-cursor</name>
<dbname>cursor</dbname>
<dbclass>Cursor</dbclass>
<desc>Specifies the mouse cursor to be used for the widget.
See <fun>Tk_GetCursor</fun> and <i>cursors(n)</i> in the Tk reference manual
for the legal values.
If set to the empty string (the default),
the cursor is inherited from the parent widget.
</desc>
</optiondef>
<optiondef>
<name>-takefocus</name>
<dbname>takeFocus</dbname>
<dbclass>TakeFocus</dbclass>
<desc>Determines whether the window accepts the focus during keyboard traversal.  
Either <b>0</b>, <b>1</b>, a command prefix (to which the widget path
is appended, and which should return <b>0</b> or <b>1</b>), 
or the empty string.
See <i>options(n)</i> in the Tk reference manual for the full description.
</desc>
</optiondef>
<optiondef>
<name>-style</name>
<dbname>style</dbname>
<dbclass>Style</dbclass>
<desc>May be used to specify a custom widget style.
</desc>
</optiondef>
</optionlist>
</section>
<section>
<title>SCROLLABLE WIDGET OPTIONS</title>
<p>The following options are supported by widgets that
are controllable by a scrollbar.  
See <i>scrollbar(n)</i> for more information
</p>
<optionlist cat="stdopt" scope="global">
<optiondef>
<name>-xscrollcommand</name>
<dbname>xScrollCommand</dbname>
<dbclass>ScrollCommand</dbclass>
<desc>A command prefix, used to communicate with horizontal scrollbars.
<?TROFF.RS?><p>When the view in the widget's window changes, the widget will
generate a Tcl command by concatenating the scroll command and
two numbers.
Each of the numbers is a fraction between 0 and 1 indicating
a position in the document; 0 indicates the beginning,
and 1 indicates the end.
The first fraction indicates the first information in the widget
that is visible in the window, and the second fraction indicates
the information just after the last portion that is visible.
</p><p>Typically the <b>xScrollCommand</b> option consists of the path name 
of a <b cat="AMBIGUOUS widget cmd">scrollbar</b> widget followed by ``set'', e.g. ``.x.scrollbar set''.
This will cause the scrollbar to be updated whenever the view in the 
window changes.
</p><p>If this option is set to the empty string (the default),
then no command will be executed.
</p><?TROFF.RE?></desc>
</optiondef>
<optiondef>
<name>-yscrollcommand</name>
<dbname>yScrollCommand</dbname>
<dbclass>ScrollCommand</dbclass>
<desc>A command prefix, used to communicate with vertical scrollbars.
See the description of <b>-xscrollcommand</b> above for details.
</desc>
</optiondef>
</optionlist>
</section>
<section>
<title>LABEL OPTIONS</title>
<p>The following options are supported by labels, buttons,
and other button-like widgets:
</p>
<optionlist cat="stdopt" scope="global">
<optiondef>
<name>-text</name>
<dbname>text</dbname>
<dbclass>Text</dbclass>
<desc>Specifies a text string to be displayed inside the widget
(unless overridden by <b>-textvariable</b>).
</desc>
</optiondef>
<optiondef>
<name>-textvariable</name>
<dbname>textVariable</dbname>
<dbclass>Variable</dbclass>
<desc>Specifies the name of variable whose value will be used
in place of the <b>-text</b> resource.
</desc>
</optiondef>
<optiondef>
<name>-underline</name>
<dbname>underline</dbname>
<dbclass>Underline</dbclass>
<desc>If set, specifies the integer index (0-based) of a character to underline 
in the text string.
The underlined character is used for mnemonic activation
(see <i>keynav(n)</i>).
</desc>
</optiondef>
<optiondef>
<name>-image</name>
<dbname>image</dbname>
<dbclass>Image</dbclass>
<desc>Specifies an image to display.
This is a list of 1 or more elements.
The first element is the default image name.
The rest of the list is a sequence of <i>statespec / value</i> pairs
as per <b>style map</b>, specifying different images to use when
the widget is in a particular state or combination of states.
All images in the list should have the same size.
</desc>
</optiondef>
<optiondef>
<name>-compound</name>
<dbname>compound</dbname>
<dbclass>Compound</dbclass>
<desc>Specifies how to display the image relative to the text,
in the case both <b>-text</b> and <b>-image</b> are present.
Valid values are: 
<dl>
<dle>
<dt>text</dt>
<dd>Display text only.
</dd>
</dle>
<dle>
<dt>image</dt>
<dd>Display image only.
</dd>
</dle>
<dle>
<dt>center</dt>
<dd>Display text centered on top of image.
</dd>
</dle>
<dle>
<dt>top</dt>
<dd/>
</dle>
<dle>
<dt>bottom</dt>
<dd/>
</dle>
<dle>
<dt>left</dt>
<dd/>
</dle>
<dle>
<dt>right</dt>
<dd>Display image above, below, left of, or right of the text, respectively.
</dd>
</dle>
<dle>
<dt>none</dt>
<dd>The default; display the image if present, otherwise the text.
</dd>
</dle>
</dl></desc>
</optiondef>
<optiondef>
<name>-width</name>
<dbname>width</dbname>
<dbclass>Width</dbclass>
<desc>If greater than zero, specifies how much space, in character widths, 
to allocate for the text label.  
If less than zero, specifies a minimum width.
If zero or unspecified, the natural width of the text label is used.

</desc>
</optiondef>
</optionlist>
</section>
<section>
<title>COMPATIBILITY OPTIONS</title>
<optionlist cat="stdopt" scope="global">
<optiondef>
<name>-state</name>
<dbname>state</dbname>
<dbclass>State</dbclass>
<desc>May be set to <b>normal</b> or <b>disabled</b>
to control the <b>disabled</b> state bit.
This is a write-only option:
setting it changes the widget state, 
but the <b>state</b> widget command 
does not affect the <b>-state</b> option.

</desc>
</optiondef>
</optionlist>
</section>
<section>
<title>COMMANDS</title>
<dl>
<dle>
<dt><m>pathName</m> <b>cget</b> <m>option</m></dt>
<dd>Returns the current value of the configuration option given
by <i>option</i>.
</dd>
</dle>
<dle>
<dt><m>pathName</m> <b>configure</b> ?<m>option</m>? ?<m>value option value ...</m>?</dt>
<dd>Query or modify the configuration options of the widget.
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.
If <i>option</i> is specified with no <i>value</i>, 
then the command returns a list describing the named option:
the elements of the list are the 
option name, database name, database class, default value, 
and current value.
If no <i>option</i> is specified, returns a list describing all of
the available options for <i>pathName</i>.
</dd>
</dle>
<dle>
<dt><m>pathName</m> <b>instate</b> <m>statespec</m> ?<m>script</m>?</dt>
<dd>Test the widget's state.
If <i>script</i> is not specified, returns 1 if 
the widget state matches <i>statespec</i> and 0 otherwise.
If <i>script</i> is specified, equivalent to
<example>
if {[<i>pathName</i> instate <i>stateSpec</i>]} <i>script</i>
</example></dd>
</dle>
<dle>
<dt><m>pathName</m> <b>state</b> ?<m>stateSpec</m>?</dt>
<dd>Modify or inquire widget state.
If <i>stateSpec</i> is present, sets the widget state: 
for each flag in <i>stateSpec</i>, sets the corresponding flag
or clears it if prefixed by an exclamation point.
<p>Returns a new state spec indicating which flags were changed:
</p><example>
set changes [<i>pathName</i> state <i>spec</i>] ; 
<i>pathName</i> state $changes
</example><p>will restore <i>pathName</i> to the original state.
If <i>stateSpec</i> is not specified, 
returns a list of the currently-enabled state flags.
</p></dd>
</dle>
</dl>
</section>
<section>
<title>WIDGET STATES</title>
<p>The widget state is a bitmap of independent state flags.
Widget state flags include:
</p>
<dl>
<dle>
<dt><b>active</b></dt>
<dd>The mouse cursor is over the widget 
and pressing a mouse button will cause some action to occur.
(aka "prelight" (Gnome), "hot" (Windows), "hover").
</dd>
</dle>
<dle>
<dt><b>disabled</b></dt>
<dd>Widget is disabled under program control 
(aka "unavailable", "inactive") 
</dd>
</dle>
<dle>
<dt><b>focus</b></dt>
<dd>Widget has keyboard focus 
</dd>
</dle>
<dle>
<dt><b>pressed</b></dt>
<dd>Widget is being pressed (aka "armed" in Motif). 
</dd>
</dle>
<dle>
<dt><b>selected</b></dt>
<dd>"On", "true", or "current" for things like checkbuttons and radiobuttons. 
</dd>
</dle>
<dle>
<dt><b>background</b></dt>
<dd>Windows and the Mac have a notion of an "active" or foreground window.
The <b>background</b> state is set for widgets in a background window,
and cleared for those in the foreground window.
</dd>
</dle>
<dle>
<dt><b>readonly</b></dt>
<dd>Widget should not allow user modification.
</dd>
</dle>
<dle>
<dt><b>alternate</b></dt>
<dd>A widget-specific alternate display format.
For example, used for checkbuttons and radiobuttons 
in the "tristate" or "mixed" state,
and for buttons with <b>-default active</b>.
</dd>
</dle>
<dle>
<dt><b>invalid</b></dt>
<dd>The widget's value is invalid.
(Potential uses: scale widget value out of bounds, 
entry widget value failed validation.)
</dd>
</dle>
</dl>
<p>A <i>state specification</i> or <i>stateSpec</i> is a list
of state names, optionally prefixed with an exclamation point (!)
indicating that the bit is off.
</p>
</section>
<section>
<title>EXAMPLES</title>
<example>
set b [ttk::button .b]

# Disable the widget:
$b state disabled			

# Invoke the widget only if it is currently pressed and enabled:
$b instate {pressed !disabled} { .b invoke }	

# Reenable widget:
$b state !disabled			
</example>
</section>
<seealso>
<ref>tile-intro(n)</ref>
<ref>style(n)</ref>
</seealso>
<keywords>
<keyword>state</keyword>
<keyword>configure</keyword>
<keyword>option</keyword>
</keywords>
</manpage>
