From: Jeff H. <je...@ac...> - 2008-11-26 00:41:38
|
Damon Courtney wrote: >> Let me note that I strongly favor some auto-naming of widgets. I >> advocate it and use it in the Perl/Tkx binding that I wrote. However, >> it conflicts with years of standard coding style in Tcl, especially >> wrt >> megawidget libraries. After looking a little further, snidgets >> could be >> made to support this at the base level in one code spot (the advantage >> of such a system). However, many older systems spread out there >> widget >> creation among the widgets in a way that is more fragile. >> >> Shall I take the opportunity to push TIP#180 again? ;) > > I would like to note that not only should TIP 180 support the > auto-naming of widgets, I would go one step further and say that TIP > 180 should also support some sort of standard, default option on all > widgets to create an "alias" of sorts. Then, I would add a single > configure command that handles them. > > 90% of the widgets created in Tk are forgotten in the code > because we don't care or need to know anything about them. This is > made even more so by things like -variable and -textvariable which > almost let us completely ignore the widget itself. For the other 10%, > we all end up coding some crap like: > > global w > > set w(myEntry) [entry .e] > $w(myEntry) configure -background blue > > This is where the new option comes in. Something like: > > entry .e -alias myEntry > configure myEntry -background blue > > Throw in the auto-naming stuff, and you've got yourself a nice > way to work with what you care about and lose the rest in the noise. Skip -alias, consider -tags (would any known widget conflict at the widget creation level?). button .b -tags toolbar button .c -tags {toolbar edge} configure toolbar -state disabled ... I simulate this at the higher level now. It may be asking too much for 8.6, but possibly worth considering. Jeff |