Posted to tcl by apw at Sun Sep 16 12:17:01 GMT 2007view pretty
Hi George, I have a perhaps not completely satisfying answer for megpkg: ::itcl::type s1 { option foo option key -configuremethod callbackKey -validatemethod valKey option anotherkey constructor {args} { configure {*}$args } method valKey {option value} { if {$value eq "bob"] { return 1 } if {$options(key) ne ""} { error "you changed -text" } return 0 } method callbackKey {option value} { set options($key) $value }} set s [s1 #auto -foo bar -key value -anotherkey value] puts [$s cget -key] $s configure -key Hello # produces the error above $s configure -key bob # sets key to bob you don't need locking as only defined options are allowed for setting and getting the options you can use configure and cget