widget -
Standard options and commands supported by widgets
This manual describes the standard options and commands supported
by all Tile widgets.
Name | Database name | Database class |
-class | (N/A) | (N/A) |
| 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 configure widget command.
|
-cursor | cursor | Cursor |
| Specifies the mouse cursor to be used for the widget.
See Tk_GetCursor and cursors(n) in the Tk reference manual
for details.
|
-takefocus | takeFocus | TakeFocus |
| Determines whether the window accepts the focus during keyboard traversal.
Either 0, 1, a command prefix (to which the widget path
is appended, and which should return 0 or 1),
or the empty string.
See options(n) in the Tk reference manual for the full description.
|
-style | style | Style |
| Not currently used; will eventually be used to specify
customized widget styles.
|
-
pathName cget option
- Returns the current value of the configuration option given
by option.
-
pathName configure ?option? ?value option value ...?
- Query or modify the configuration options of the widget.
If one or more option-value 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 option is specified with no value,
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 option is specified, returns a list describing all of
the available options for pathName.
-
pathName instate statespec ?script?
- Test the widget's state.
If script is not specified, returns 1 if
the widget state matches statespec and 0 otherwise.
If script is specified, equivalent to
if {[pathName instate stateSpec]} script.
-
pathName state ?stateSpec
- Modify or inquire widget state.
If stateSpec is present, sets the widget state:
for each flag in stateSpec, sets the corresponding flag
or clears it if prefixed by an exclamation point.
Returns a new state spec indicating which flags were changed:
''set changes [pathName state spec] ;
pathName state $changes''
will restore pathName to the original state.
If stateSpec is not specified,
returns a list of the currently-enabled state flags.
The widget state is a bitmap of independent state flags.
Widget state flags include:
- active
- The mouse cursor is over the widget
(aka "prelight" (Gnome), "hot" (Windows), "hover").
- disabled
- Widget is disabled under program control
(aka "unavailable", "inactive")
- focus
- Widget has keyboard focus
- pressed
- Widget is being pressed (aka "armed" in Motif).
- selected
- "On", "true", or "current" for things like checkbuttons and radiobuttons.
A state specification or stateSpec is a list
of state names, optionally prefixed with an exclamation point (!)
indicating that the bit is off.
set b [tbutton .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
tile-intro(n), style(n)
state, configure, option