The Preferences User Interface

The figure shows the interface for the items added with the Pref_Add command given in the previous section. The pop-up window with the extended help text appears after you click on “Scrollbar placement.” The user interface to the preference settings is table-driven. As a result of all the Pref_Add calls, a single list of all the preference items is built. The interface is constructed by looping through this list and creating a user interface item for each:

Example 42-5 A user interface to the preference items.


proc Pref_Dialog {} { global pref if [catch {toplevel .pref}] { raise .pref } else { wm title .pref "Preferences" ...

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.