From: Damon C. <da...@tc...> - 2005-11-10 01:48:26
|
All, Would anyone be opposed to me adding a -validtype argument to options in SNIT? The purpose is to add a feature that nearly every megawidget system needs but most write their own for. Goes like this: option add -state -default normal -validtype {enum {disabled normal}} option add -background -default white -validtype color option add -autoscroll -default 1 -validtype boolean option add -index -default 0 -validtype int etc.. All it really does is override the -validatemethod for the given option with a proc called snit::validateOption that does the very basic validation of an option based on type. The types I've defined are: boolean color enum int nullboolean (can be boolean or null) padding (can be a single number or a pair of numbers) There are more you can add, but that is all that BWidget uses, and it pretty much covers the basics. I already have the code done if everyone can agree that it's a worthwhile change. I'd really hate to see every single megawidget system built on top of SNIT have to define all this themselves. It's a fundamental piece. Even Tk has a standard routine for checking options (at the C level, mind you). Damon |