Subwidgets
Rob Seegel <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
I know the various arguments about breaking encapsulations and all, but
I could really use a more convenient method of
configuing subwidgets. I'm currently in the process of revamping
JComboBox. I've compiled a list of complaints and ideas
from the past year or so, and I'm trying to smooth out the rough spots,
simplify it where I can, while at the same time adding
some new functionality. My approach is to document the Subwidgets as
well as I can -- especially where developers might run into
trouble when configuring them directly, and to phase out several options.
I'm using another method, that would be highly convenient if it or
something like it were added to Tk::Derived. I think I've
mentioned the method on this forum or c.l.p.tk before -- It's called:
configureSubwidgets. An example usage would be something
like:
$jcomboBox->configureSubwidgets(
## Config a blue background for both Button and popup
[qw/Button Popup/] => { -bg => 'blue' },
## Config white background, and blue foreground for Box and Listbox
[qw/Box Listbox/] => { -bg => 'white', -fg => 'blue' },
## Config borderwidth of 2, relief of sunken for Popup
Popup => { -bd => 2, -relief => 'sunken' }
);
This method would take 1..n pairs of Subwidget name(s)/Config
Parameters, the first iterm in the pair would be a single Subwidget name
or an Array reference containing one or more Subwidget names, and the
second item would contain a hash ref of configuration parameters that
would be passed to the named Subwidget(s). It's meant as a convenience
more than anything else. JComboBox will also have a -subwidgets option
that will be able to take a similar structure.
I'm interested in what people think of this idea (The good, bad, and the
ugly), and In the end, it doesn't particularly bother me one way or
another if functionality like this goes into Tk::Derived or not, but it
would allow me to take it out of several other widgets I'm working on ;-)
Rob
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]