tko::state -- widget state handling

SYNOPSIS

::tko::state commandsadd name ?command? ..

::tko::state commandsget name ?pattern?

::tko::state commandsdel name ?pattern?

::tko::state namedel ?pattern?

::tko::state nameset name value commandlist

::tko::state nameget ?pattern?

::tko::state valueget name

::tko::state valueset ?..?

DESCRIPTION

The tko::state function cann be used to collect, manage and change state informations using state variables. State variable are unique string values managed by the tko::state function. Each variable has a value. The value can be every ordinary string. Normally state values of widgets are p.e. normal and disabled. Each state variable can have a list of associated commands. After changinig the value of an state variable all the associated command will be called with the new value appended.

FUNCTIONS

tko::state commandsadd name ?command? ..

Bind all the given command to changes in a state variable name. All given command will be called with the current value of the state variable. If the state variable name not exists an error is thrown.

tko::state commandsget name ?pattern?

Return a list of commands bound to the given state variable name and glob style matching the given pattern. If no pattern is given it defaults to "*". If the state variable name not exists an error is thrown.

tko::state commandsdel name ?pattern?

Delete all commands glob style matching the given pattern from the given state variable name. If no pattern is given it defaults to "*". If the state variable name not exists an error is thrown.

tko::state namedel ?pattern?

Delete all state variable glob style matching the given pattern. Return the list of the remaining state variables.

tko::state nameset name value commandlist

Define a new state variable name with an initial value and a commandlist of commands. All given commands from commandlist will be called with the given value. If there is an error no state variable will be defined.

tko::state nameget ?pattern?

Return a list of used state variables.

tko::state valueget value

Return the current value of the given state variable name.

tko::state valueset ?name value? ..

Call all defined commands of the given state variables name with the given value. The given value will be saved for further usage. If no value is given then call the commands with the current value.

For each not existing state variable name or for each failing call of a command with the new value an error line will be appended to the return value. An empty return value indicate success.

SEE ALSO

tko bind

KEYWORDS

binding

COPYRIGHT

© 2021- Rene Zaumseil r.zaumseil@freenet.de

BSD style license.