TIP: | 319 |
Title: | Implement Backwards Compatibility for ttk Themed Widgets in tk Widgets |
Version: | $Revision: 1.4 $ |
Author: | Eric Taylor <et2 at rocketship1 dot biz> |
State: | Draft |
Type: | Project |
Tcl-Version: | 8.7 |
Vote: | Pending |
Created: | Wednesday, 04 June 2008 |
This TIP calls for the implementation of backward compatibility between ttk themed widgets and conventional tk widgets. It does this by describing configuration options that specify how to deal with unsupported options (error, ignore, or call supplied callbacks) where full compatibility is not feasible. Configuration should be both global (all widgets) and specific (by class or individual widget).
Tk 8.5 now includes a parallel set of widgets, created through calls to similar widget constructors, but invoked using the namespace ttk:: prepended to the name of an existing widget. For example, ttk::button creates a themed button, while the unqualified button creates standard Tk button widgets.
One of the stated purposes of these new widgets is to bring Tk up to the standards now expected for attractive looking GUI programs. The ttk package does this quite well, but only for new programs. Imagine the leverage we would have if we could upgrade older programs (easily and automatically) to use these widgets. While one can use an editor and add in the ttk:: to each widget creation call (which then begs the question of why we can't have this done automatically with a simple configuration procedure) one is often stuck when trying to implement the same behavior since many Tk options which are currently unsupported in ttk.
In addition, there are packages, such as visual tcl, which write conventional tk code. These programs cannot easily be converted to use the new widgets, but still need to be maintained using the vtcl program.
This TIP proposes that all current Tk widget options be supported where feasible and that the following command be fully implemented to permit older Tk-oriented programs run unaltered using the themed set of widgets.
namespace import -force ttk::*
Since the ttk widgets don't have all the same options, there would need to be some compatibility code that could simulate the old behavior. For example, in button, there is no longer a -background color option, nor is there -padx and -pady. Sometimes these missing options can be implemented, for example, using -padding would let one implement partial behavior. While it would be preferable to implement these options directly, an alternative would be to select a compatability handling mode of ignore, error, or callback to aid the developer in implementing missing options.
To that purpose, I propose some kind of configuration option, for example:
ttk::compatibility ?-onerror [ignore|error|callback]? ?-callback proc? ?-class [widget-class|all]?
When the callback procedure is invoked, it should be passed additional parameters which would completely identify,
The widget (e.g. .frame.button)
The option that is not directly supported (e.g. -pady)
The value specified for that option (the argument following the -option)
Anything else I've forgotten
The above should also be configured globally (all widgets) or on a widget by widget basis. For individual widgets, there should be a configuration option for the above.
I would think that most of this should be implementable with pure tcl/tk proc's.
This document has been placed in the public domain.
[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]
TIP AutoGenerator - written by Donal K. Fellows