Saving and Loading Bindings

All that remains is the actual change or definition of a binding and some way to remember the bindings the next time the application is run. The BindDefine procedure attempts a bind command that uses the contents of the entries. If it succeeds, then the edit window is removed by unpacking it.

The bindings are saved by Bind_Save as a series of Tcl commands that define the bindings. It is crucial that the list command be used to construct the commands properly.

Bind_Read uses the source command to read the saved commands. The application must call Bind_Read as part of its initialization to get the customized bindings for the widget or class. It also must provide a way to invoke Bind_Interface, such as a button, menu ...

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.