Version 2 of radiobox

Updated 2003-06-06 15:24:40

An IWidget. Screenshot: http://incrtcl.sourceforge.net/iwidgets/iwidgets/radiobox.gif

Docs can be found at http://incrtcl.sourceforge.net/iwidgets/iwidgets/radiobox.html and http://purl.org/tcl/home/man/iwidgets3.0/radiobox.n.html


Although with the modern labelframe, such a megawidget can easily be hand-rolled:

 proc radiobox {wpath args} {
    array set opt {-text "" -values ""}
    set opt(-variable) $wpath ;# default, if not specified
    array set opt $args
    labelframe $wpath -text $opt(-text)
    foreach value $opt(-values) {
        radiobutton $wpath.v$value -text $value -variable $opt(-variable)\
            -value $value
    }
    set ::$opt(-variable) [lindex $opt(-values) 0]
    eval pack [winfo children $wpath] -anchor w
    set wpath

} #----- Test:

 set fonts {Helvetica Courier Times Symbol}
 pack [radiobox .r -text "Select a font" -variable v -values $fonts]
 trace var v w  {wm title . $v;#} ;# to see that the variable changes

Category Command, a part of incr Widgets