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. ... |
Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.