Events contain the information that handlers have to deal with. In other words, events encode the information resulting from invoking a script command, a user action (such as moving the mouse pointer) transmitted by the window environment, and several other kinds of events. The average user only has to deal with information coming from (Tcl) script commands or X window events. In a general way, events may be regarded to be the glue in hush and its extensions. See also the comments below.
interface event { <hush/event.h>
<hush/event.idl>
sources/java/hush.dv.api.event
int argc() const; no. of arguments
char** argv(int i=0) const; the (Tcl) string arguments
char* arg(int i=0) const; to fetch i th argument
char* args(int i) const; string from i'th to last arg
int type() const; X event type
int x();
int y();
int keycode();
};
For the average user event objects represent the events generated by the X-window system of the embedded (Tcl) script language interpreter. Each event has a type, which may be one of the types listed below. The type of the event can be inspected with type() which returns an integer value or name() which returns a string representation of the type. For some of the common event types, such as ButtonPress, ButtonRelease, and MotionNotify, member functions are provided to facilitate testing. If an integer argument (1,2 or 3) is given to button(), buttonup() or buttonevent(), it is checked whether the event has occurred for the corresponding button. The functions x() and y() deliver the widget coordinates of the event, if appropriate. Calling trace for the event results in printing the type and coordinating information for the event. When setting the kit::trace level to 2 this information is automatically printed. Programmers not satisfied with this interface can check the type and access the underlying XEvent at their own risk.
tcl_event -- from the binding of a handler to a Tcl command
file_event -- from the binding of a handler to a file descriptor
url_event -- (under construction)
tt_event -- (under construction)
These special event classes are for advanced users
only.
Events are passed to the handler::dispatch function. To deal with the arguments of a (Tcl) callback or (for example) the arguments that result from invoking a menu or button handler one may use a line such as:
int argc = _event->argc(); char** argv = _event->argv();or alternatively
string args = _event;Such calls typically occur in the operator() function of a handler object.see string(4)
Advanced users may develop their own event classes, as well as their own handler callback functions.
Actually the event class is a rather overloaded class, since it is shared by the hush widget classes and the simulation package sim. Don't bother with its complexity, from each perspective the event class offers exactly (?) what you need.
hush -- file <hush/event.h>
KeyPress KeyRelease ButtonPress ButtonRelease MotionNotify EnterNotify LeaveNotify FocusIn FocusOut KeymapNotify Expose GraphicsExpose NoExpose VisibilityNotify CreateNotify DestroyNotify UnmapNotify MapNotify MapRequest ReparentNotify ConfigureNotify ConfigureRequest GravityNotify ResizeRequest CirculateNotify CirculateRequest PropertyNotify SelectionClear SelectionRequest SelectionNotify ColormapNotify ClientMessage MappingNotify LASTEvent
Consult your X (or Tcl/Tk) documentation for a full explanation of these (X) event types.
|
Hush Online Technology
hush@cs.vu.nl
09/24/99 |
|
|