NAME
Tk::bound - change the base class for bound binded widgets.
SYNOPSIS
Retreive boundings:
$widget->bound
$widget->bound(tag)
$widget->bound(sequence)
Associate and destroy boundings:
$widget->bound(sequence,oob)
$widget->bound(sequence,oob,callback)
$widget->bound(tag,sequence,oob)
$widget->bound(tag,sequence,oob,callback)
DESCRIPTION
The bound method associates callbacks with X events. If oob is specified, bound will arrange for oob to be evaluated whenever the event(s) given by sequence occur in the window(s) identified by $widget or tag. If oob is an empty string then the current binding for sequence is destroyed, leaving sequence bound less. In all of the cases where a oob argument is provided, bind returns an empty string. If oob is specified and evaluated to a valid out of bounds bit mask, then bound will arrange for callback to be called, if specified, for the previous callback to be called otherwise.
If sequence is specified without oob, then the out of bounds callback currently bound to sequence is returned, or undef is returned if there is no bounding for sequence. If neither sequence nor callback is specified, then the return value is a list whose elements are all the sequences for which there exist boundings for tag.
If no tag is specified then the bound refers to $widget. If tag is specified then it is typically a class name and the bound refers to all instances of the class on the MainWindow associated with $widget. (It is possible for tag to be another "widget object" but this practice is deprecated.) Perl's ref($object) can be used to get the class name of any object. Each window has an associated list of tags, and a bounding applies to a particular window if its tag is among those specified for the window. Although the bountags method may be used to assign an arbitrary set of bounding tags to a window, the default bounding tags provide the following behavior:
If a tag is the name of an internal window the bounding applies to that window.
If the tag is the name of a toplevel window the bounding applies to the toplevel window and all its internal windows.
If the tag is the name of a class of widgets, such as Tk::Button, the bounding applies to all widgets in that class;
If tag has the value all, the bounding applies to all windows descended from the MainWindow of the application.
EVENT PATTERNS
Please refer to the Tk::bind manual page.
MODIFIERS
Please refer to the Tk::bind manual page.
EVENT TYPES
Please refer to the Tk::bind manual page.
OUT OF BOUND BITMASKS
The oob argument to bound is a bitmask that specifies the out of bounds situation. It is evaluted by the bound function as a bitmask value or as a callback that returns a bitmask value. The bits in the bitmask specifies the relative positions and level in the bounding tags (See Tk::boundtags for description of the possible forms.) of the out of bounds callback (the next bit) and the previous callback (the previous bit). Bitmaks are made of the letters n, N, p, P, where lowercase specifies enabled and uppercase specifies disabled.
The out of bound bitmask is to be taken among the following constant values :
- 'np'
-
next callback is called before previous callback;
- 'nP'
-
next callback is called before without previous callback;
- 'Np'
-
previous callback only, this is the default situation;
- 'NP'
-
void;
- 'pn'
-
previous callback is called before next callback;
- 'pN'
-
previous callback only, this is the default situation;
- 'Pn'
-
next callback only;
- 'PN'
-
void.
BOUNDING CALLBACKS AND SUBSTITUTIONS
The callback argument to bound is a perl/Tk callback. which will be executed whenever the given event sequence occurs. (See Tk::callbacks for description of the possible forms.) Callback will be associated with the same MainWindow that is associated with the $widget that was used to invoke the bound method, and it will run as though called from MainLoop. If callback contains any bEv(%) calls, then each "nested" bEv(%) "callback" will be evaluated when the event occurs to form arguments to be passed to the main callback. The replacement depends on the character %, as defined in the list below. Unless otherwise indicated, the replacement string is the Ev(%) numeric (decimal) value of the given field from the current event.
- 't'
-
The tag used (or calculated) when out of bounds event arises.
- 's'
-
The sequence when out of bounds event arises.
- 'S'
-
The normalised sequence when out of bounds event arises.
- 'c'
-
The evaluated previous callback when out of bounds event arises.
- 'm'
-
The mask when out of bounds event arises.
OUT OF BOUND LEVEL
It is possible for an already bound binded widget event to be bound binded again, increasing its out of bound level. The level is specified by the bountags function.
ERRORS
Please refer to the Tk::bind manual page.
head1 SEE ALSO
Tk::Error Tk::callbacks Tk::bindtags Tk::boundtags
KEYWORDS
Event, binding