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 Widget Class Command

The Tcl command that creates an instance of a widget is known as the class command. In our example, the clock command creates a clock widget. The command procedure for clock follows. The procedure allocates the Clock data structure. It registers an event handler that gets called when the widget is exposed, resized, or gets the focus. It creates a new Tcl command that operates on the widget. Finally, it calls ClockConfigure to set up the widget according to the attributes specified on the command line and the default configuration specifications.

Example 46-3 The ClockCmd command procedure.
 int ClockCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window of the app */ Tcl_Interp *interp; /* Current interpreter. ...

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