O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Window Event Procedure

Each widget registers an event handler for expose and resize events. If it implements a focus highlight, it also needs to be notified of focus events. If you have used other toolkits, you may expect to register callbacks for mouse and keystroke events too. You should not need to do that. Instead, use the regular Tk bind facility and define your bindings in Tcl. That way they can be customized by applications. This procedure is identical in both versions of the widget.

Example 46-15 The ClockEventProc handles window events.
 static void ClockEventProc(ClientData clientData, XEvent *eventPtr) { Clock *clockPtr = (Clock *) clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required