Table of Contents
Tcl/Tk features an elaborated event handling model. A series of event handler sets is automatically assigned to a window. The assigned sets can be regrouped and extended with new sets.
In Example 8.1, “Event Handler Sets”, the current window path name is ».t« and its class is »Sample«. The »all« set is something like a rest event handler. The window ».t« is a »toplevel« window, hence only three event handler sets are present. Every non-toplevel window underneath .t will feature ».t« as an event handler set, just before »all«.
Jeszra only maintains the window related event handler set. Such as ».t« for the toplevel window. Other event handler sets are better written inside a editor and bound to the window using the »bindtags« command. The »Events« page in the Inspector can be used to create event handlers for a given event and to assign it to the window set.
After the Figure 8.1, “Define an Event” is completed with adding »1« –the left mouse-button. A new event handler for the left mouse button was created for the window, and is now dispalyed inside the »Event« page: Modify an Event-Script.
The default script for the event handler in Modify an Event-Script is just a comment. You have to replace this script with something more meaningful. The context menu provides some predefined scripts, listing the valid %- place holders. In Figure 8.3, “Place holders from the Context Menu”, the first entry is depicted. The %- place holders are described in the bind manual page.
Most Relevant % place holder
%W for the window path name, the event was generated for this window.
%x, %y relative cursor position, distance from the window (%W) top left corner.
%X, %Y absolute cursor position, from the desktop.
This chapter is abridged. The full text is available in printed form or as a PDF from: www.lulu.com.