beetlebug▾
/

ttk::scale instate

Tests the state flags of the widget, and runs a script when they match.

PATHNAME instate STATESPEC ?SCRIPT?

Description

STATESPEC is a list of flags, each with an optional ! before it. The spec matches when each plain flag is on and each flag with ! is off. With no SCRIPT, gives 1 for a match and 0 for no match. With SCRIPT, runs it at the global level on a match and gives its result, else gives an empty string.

Returns

1 or 0, or the result of SCRIPT.

Examples

% ttk::scale .tscis
> .tscis state disabled
> list [.tscis instate disabled] [.tscis instate !disabled]
1 0

% ttk::scale .tscis2
> .tscis2 instate !disabled {list ok}
ok

Errors

% ttk::scale .tscis3; .tscis3 instate
wrong # args: should be ".tscis3 instate state-spec ?script?"
-errorcode NONE

% ttk::scale .tscis4; .tscis4 instate bogus
Invalid state name bogus
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also