next up previous contents
Next: Full Bindings Up: Events Previous: Simple Clicks

Simple Binds

For all GUI elements, the function HTk.html#HTk.bindSimplebindSimple provides a simple way of binding. Its arguments are the GUI element concerned, and a specification of the kind of events we are interested in:

HTk.html#HTk.WishEventTypeWishEventType is an algebraic data type describing the kind of event we would like to bind to, much along the lines of Tk's events:

Each constructor corresponds to a different event, such as

Note that not every GUI element can generate every event. Obviously, only windows can generate window events, but more subtly, only entry widgets, editor widgets and toplevels (i.e. windows) can generate Key events.

The return value of bind is an event, and an IO action which unbinds the event. You should use this action if you are not interested in the event anymore (i.e. it will not be synchronised on anymore), otherwise there will be a memory leak.

Christoph Lueth
Wed May 29 13:20:38 MEST 2002