beetlebug▾
/

tui::bindtui

Binds a script to an event of a widget, of a class, of the toplevel, or of all.

tui::bind TAG ?SEQUENCE? ?SCRIPT?

Description

An event goes to the bindings of its tags in the order of Tk: the path of the widget, its class (Button, Label, or Frame), the toplevel ., and all. A sequence is <Key>, <Key-x>, <x>, <Return>, <Control-c>, <Shift-Tab>, or <Button-1>. The script gets %W, %K, %A, %x, and %y, and break stops the tags after it. An empty SCRIPT removes the binding, and a SCRIPT with + at the start adds to it.

Returns

The scripts of the tag, the script of the sequence, or an empty string.

Examples

% tui::label .k; tui::bind all <Key-q> {set ::q yes}; tui::send q; set ::q
yes

% tui::bind all
<Key-q>

Errors

% tui::bind all <Nope {}
bad event type or keysym "<Nope"
-errorcode TK EVENT

Facts

Capability
tui. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.7

The full page: tui::bind.

See also