From: Jeff H. <je...@Ac...> - 2005-11-10 17:52:20
|
Damon Courtney wrote: > 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: ... > 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) This has already been covered on the snit mailing list in August (I brought it up). You can find the posts in the archives of August 2005, but my proposal was essentially: option -foo -type ... 1 {enum [list of values]} 2 {int ?-list {minlen maxlen}? ?{min max}? ?...?} 3 {double ?-list {minlen maxlen}? ?{min max}? ?...?} 4 {pixels ?-list {minlen maxlen}? ?{min max}? ?...?} 5 {window ?$parent?} (uses [winfo exists]) 6 {bool} 7 {method $snitmethod ?arg? ?arg?} 8 {command $proc ?arg? ?arg?} 9 {regexp ?-nocase? $RE} 10 {glob ?-nocase? $pattern} Stuff from Tk_Config that might be checkable: color cursor font The -list option handle multiple of the same type (like for -padx). This covers just about everything, I think. Jeff |