Changeset 6372


Ignore:
Timestamp:
Jun 2, 2016 3:41:01 PM (8 years ago)
Author:
dkearney
Message:

adding multichoice widget from the multichoice branch

Location:
trunk
Files:
1 added
13 edited
9 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/configure

    r6229 r6372  
    1022510225
    1022610226
    10227 ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/copy_rappture_examples gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile gui/src/Makefile builder/Makefile builder/pkgIndex.tcl builder/scripts/Makefile tester/Makefile tester/pkgIndex.tcl tester/scripts/Makefile lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/R/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/scripts/Makefile lang/tcl/src/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/octave2/Makefile examples/app-fermi/octave/octave3/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/perl/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/app-fermi/R/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/mapviewer/Makefile examples/mapviewer/camera/Makefile examples/mapviewer/colorramp/Makefile examples/mapviewer/common/Makefile examples/mapviewer/feature/Makefile examples/mapviewer/gdal/Makefile examples/mapviewer/layers/Makefile examples/mapviewer/ogr/Makefile examples/mapviewer/placard/Makefile examples/mapviewer/select/Makefile examples/mapviewer/tms/Makefile examples/mapviewer/wms/Makefile examples/mapviewer/xyz/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/curve/Makefile examples/zoo/drawing/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/histogram/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/log/Makefile examples/zoo/mesh/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/parallelepiped/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile video/Makefile video/pkgIndex.tcl oldtest/Makefile oldtest/src/Makefile puq/Makefile puq/puq.sh"
     10227ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/copy_rappture_examples gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile gui/src/Makefile builder/Makefile builder/pkgIndex.tcl builder/scripts/Makefile tester/Makefile tester/pkgIndex.tcl tester/scripts/Makefile lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/R/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/scripts/Makefile lang/tcl/src/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/octave2/Makefile examples/app-fermi/octave/octave3/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/perl/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/app-fermi/R/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/mapviewer/Makefile examples/mapviewer/camera/Makefile examples/mapviewer/colorramp/Makefile examples/mapviewer/common/Makefile examples/mapviewer/feature/Makefile examples/mapviewer/gdal/Makefile examples/mapviewer/layers/Makefile examples/mapviewer/ogr/Makefile examples/mapviewer/placard/Makefile examples/mapviewer/select/Makefile examples/mapviewer/tms/Makefile examples/mapviewer/wms/Makefile examples/mapviewer/xyz/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/curve/Makefile examples/zoo/drawing/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/histogram/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/log/Makefile examples/zoo/mesh/Makefile examples/zoo/multichoice/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/parallelepiped/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile video/Makefile video/pkgIndex.tcl oldtest/Makefile oldtest/src/Makefile puq/Makefile puq/puq.sh"
    1022810228
    1022910229cat >confcache <<\_ACEOF
     
    1104511045    "examples/zoo/log/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/log/Makefile" ;;
    1104611046    "examples/zoo/mesh/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/mesh/Makefile" ;;
     11047    "examples/zoo/multichoice/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/multichoice/Makefile" ;;
    1104711048    "examples/zoo/note/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/note/Makefile" ;;
    1104811049    "examples/zoo/note/docs/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/note/docs/Makefile" ;;
  • trunk/configure.in

    r6229 r6372  
    603603    examples/zoo/log/Makefile
    604604    examples/zoo/mesh/Makefile
     605    examples/zoo/multichoice/Makefile
    605606    examples/zoo/note/Makefile
    606607    examples/zoo/note/docs/Makefile
  • trunk/examples/zoo/Makefile.in

    r3714 r6372  
    3030                log \
    3131                mesh \
     32                multichoice \
    3233                note \
    3334                number \
  • trunk/gui/scripts/Makefile.in

    r6366 r6372  
    8383                $(srcdir)/meshresult.tcl \
    8484                $(srcdir)/molvisviewer.tcl \
     85                $(srcdir)/multichoiceentry.tcl \
    8586                $(srcdir)/nanovisviewer.tcl \
    8687                $(srcdir)/note.tcl \
  • trunk/gui/scripts/combobox.tcl

    r5659 r6372  
    175175
    176176# ----------------------------------------------------------------------
    177 # USAGE: getValue <value>
    178 #
    179 # Clients use this to translate a value to a label.
     177# USAGE: current
     178#
     179# Clients use this to retrieve a label from the entry widget and return
     180# its value, if one exists. If no value exists for the label, then the
     181# label is returned.
    180182# ----------------------------------------------------------------------
    181183itcl::body Rappture::Combobox::current {} {
  • trunk/gui/scripts/combochecks.tcl

    r5659 r6372  
    1919option add *Combochecks.relief sunken widgetDefault
    2020option add *Combochecks.width 10 widgetDefault
     21option add *Combochecks.editable yes widgetDefault
    2122option add *Combochecks.textBackground white widgetDefault
    2223option add *Combochecks.textForeground black widgetDefault
     
    2829    inherit itk::Widget
    2930
     31    itk_option define -editable editable Editable ""
    3032    itk_option define -state state State "normal"
    3133    itk_option define -width width Width 0
    3234    itk_option define -disabledbackground disabledBackground DisabledBackground ""
    3335    itk_option define -disabledforeground disabledForeground DisabledForeground ""
     36    itk_option define -interactcommand interactCommand InteractCommand ""
    3437
    3538    constructor {args} { # defined below }
    3639
    3740    public method value {args}
    38     public method current {}
     41    public method translate {value {defValue ""}}
     42    public method label {value}
    3943    public method choices {option args}
    4044
    4145    protected method _entry {option}
    42     protected method _fixDisplay {}
     46    protected method _dropdown {option}
    4347    protected method _fixState {}
    4448
     
    5761    keep -foreground -background
    5862    keep -textforeground -textbackground
     63    keep -selectbackground -selectforeground -selectborderwidth
    5964}
    6065
     
    95100
    96101    itk_component add ddlist {
    97         Rappture::Dropdownchecks $itk_component(button).ddlist
    98     }
     102        Rappture::Dropdownchecks $itk_component(button).ddlist \
     103            -postcommand [itcl::code $this _dropdown post] \
     104            -unpostcommand [itcl::code $this _dropdown unpost] \
     105    }
     106
    99107    bind $itk_component(ddlist) <<DropdownchecksSelect>> \
    100         [itcl::code $this _fixDisplay]
     108        [itcl::code $this _dropdown select]
    101109
    102110    $itk_component(button) configure -command \
     
    115123# ----------------------------------------------------------------------
    116124itcl::body Rappture::Combochecks::value {args} {
    117     switch -- [llength $args] {
    118         0 {
    119             # return a list of checked optons
    120             set max [$itk_component(ddlist) size]
    121             set rlist ""
    122             foreach val [$itk_component(ddlist) get -value] {
    123                 if {[$itk_component(ddlist) state $val]} {
    124                     lappend rlist $val
    125                 }
    126             }
    127             return $rlist
    128         }
    129         1 {
    130             set newval [lindex $args 0]
    131 
    132             $itk_component(ddlist) reset
    133             foreach part $newval {
    134                 $itk_component(ddlist) state $part 1
    135             }
    136             _fixDisplay
    137 
    138             after 10 [list catch \
    139                 [list event generate $itk_component(hull) <<Value>>]]
    140 
    141         }
    142         default {
    143             error "wrong # args: should be \"value ?newval?\""
    144         }
    145     }
     125    if {[llength $args] == 1} {
     126        set newval [lindex $args 0]
     127
     128        # FIXME: not sure if I need to update the ddlist just in case
     129        # user calls value() without manipulating the ddlist
     130        $itk_component(ddlist) reset
     131        foreach part $newval {
     132            set part [translate $part]
     133            $itk_component(ddlist) state $part 1
     134        }
     135
     136        $itk_component(entry) configure -state normal
     137        $itk_component(entry) delete 0 end
     138        $itk_component(entry) insert end [join $newval {, }]
     139        if {!$itk_option(-editable)} {
     140            $itk_component(entry) configure -state disabled
     141        }
     142
     143        after 10 [list catch \
     144            [list event generate $itk_component(hull) <<Value>>]]
     145    } elseif {[llength $args] != 0} {
     146        error "wrong # args: should be \"value ?newval?\""
     147    }
     148    return [$itk_component(entry) get]
     149}
     150
     151# ----------------------------------------------------------------------
     152# USAGE: translate <value>
     153#
     154# Clients use this to translate a value from the entry part of the
     155# combobox to one of the underlying values in the combobox.  If the
     156# <value> string matches one of the labels for the choices, this
     157# method returns the corresponding value.  Otherwise, it returns "".
     158# ----------------------------------------------------------------------
     159itcl::body Rappture::Combochecks::translate {value {defValue ""}} {
     160    foreach {val label} [choices get -both] {
     161        if {$label eq $value} {
     162            return $val
     163        }
     164    }
     165    return $defValue
     166}
     167
     168# ----------------------------------------------------------------------
     169# USAGE: label <value>
     170#
     171# Clients use this to translate a value to a label.
     172# ----------------------------------------------------------------------
     173itcl::body Rappture::Combochecks::label { myValue } {
     174    foreach {val label} [choices get -both] {
     175        if {$myValue == $val} {
     176            return $label
     177        }
     178    }
     179    return ""
    146180}
    147181
     
    167201# USAGE: _entry click
    168202#
     203# Used internally to handle the entry widget for this combobox.  The
     204# click option is invoked when the user click on the entry widget and
     205# performs a post operation on the dropdown list. The apply option
     206# is invoked when the user presses the Return key to set the value of
     207# the entry widget or selects a value. It generates a Value signal.
     208# ----------------------------------------------------------------------
     209itcl::body Rappture::Combochecks::_entry {option} {
     210    switch -- $option {
     211        apply {
     212            if {$itk_option(-editable) && $itk_option(-state) == "normal"} {
     213                event generate $itk_component(hull) <<Value>>
     214                if {[string length $itk_option(-interactcommand)] > 0} {
     215                    uplevel #0 $itk_option(-interactcommand)
     216                }
     217            }
     218        }
     219        click {
     220            if {!$itk_option(-editable) && $itk_option(-state) == "normal"} {
     221                $itk_component(button) configure -relief sunken
     222                update idletasks; after 100
     223                $itk_component(button) configure -relief raised
     224
     225                $itk_component(ddlist) post $itk_component(hull) left
     226            }
     227        }
     228        default {
     229            error "bad option \"$option\": should be apply, click"
     230        }
     231    }
     232}
     233
     234# ----------------------------------------------------------------------
     235# USAGE: _dropdown post
     236# USAGE: _dropdown unpost
     237# USAGE: _dropdown select
     238#
    169239# Used internally to handle the dropdown list for this combobox.  The
    170240# post/unpost options are invoked when the list is posted or unposted
    171241# to manage the relief of the controlling button.  The select option
    172242# is invoked whenever there is a selection from the list, to assign
    173 # the value back to the gauge.
    174 # ----------------------------------------------------------------------
    175 itcl::body Rappture::Combochecks::_entry {option} {
     243# the value back to the entry.
     244# ----------------------------------------------------------------------
     245itcl::body Rappture::Combochecks::_dropdown {option} {
    176246    switch -- $option {
    177         apply {
    178             if {$itk_option(-state) == "normal"} {
    179                 event generate $itk_component(hull) <<Value>>
    180             }
    181         }
    182         click {
    183             if {$itk_option(-state) == "normal"} {
    184                 $itk_component(button) configure -relief sunken
    185                 update idletasks; after 100
    186                 $itk_component(button) configure -relief raised
    187 
    188                 $itk_component(ddlist) post $itk_component(hull) left
     247        post {
     248#            set value [$itk_component(entry) get]
     249#            set i [$itk_component(ddlist) index -label $value]
     250#            if {$i >= 0} {
     251#                $itk_component(ddlist) select clear 0 end
     252#                $itk_component(ddlist) select set $i
     253#            }
     254        }
     255        unpost {
     256            if {$itk_option(-editable)} {
     257                focus $itk_component(entry)
     258            }
     259        }
     260        select {
     261            set newval [$itk_component(ddlist) current -label]
     262            set val [$itk_component(entry) get]
     263            if {$newval ne "" && $newval ne $val} {
     264                value $newval
     265                if {[string length $itk_option(-interactcommand)] > 0} {
     266                    uplevel #0 $itk_option(-interactcommand)
     267                }
     268            }
     269            if {$newval eq ""} {
     270                value $val
    189271            }
    190272        }
    191273        default {
    192             error "bad option \"$option\": should be apply, click"
    193         }
    194     }
    195 }
    196 
    197 # ----------------------------------------------------------------------
    198 # USAGE: _fixDisplay
    199 #
    200 # Used internally to handle the dropdown list for this combobox.
    201 # Invoked whenever there is a selection from the list, to assign
    202 # the value back to the entry.
    203 # ----------------------------------------------------------------------
    204 itcl::body Rappture::Combochecks::_fixDisplay {} {
    205     $itk_component(entry) configure -state normal
    206     $itk_component(entry) delete 0 end
    207     $itk_component(entry) insert end [join [value] {, }]
    208     $itk_component(entry) configure -state disabled
     274            error "bad option \"$option\": should be post, unpost, select"
     275        }
     276    }
    209277}
    210278
     
    212280# USAGE: _fixState
    213281#
    214 # Used internally to fix the widget state when the -state option
    215 # changes.
     282# Used internally to fix the widget state when the -editable/-state
     283# options change.
    216284# ----------------------------------------------------------------------
    217285itcl::body Rappture::Combochecks::_fixState {} {
     
    232300    }
    233301
    234     if {$itk_option(-state) != "normal"} {
     302    if {$itk_option(-editable)} {
     303        if {$itk_option(-state) == "normal"} {
     304            $itk_component(entry) configure -state normal
     305        } else {
     306            $itk_component(entry) configure -state disabled
     307        }
     308    } else {
     309        $itk_component(entry) configure -state disabled
     310    }
     311
     312    if {!$itk_option(-editable) || $itk_option(-state) != "normal"} {
    235313        # can't keep focus here -- move it along to the next widget
    236314        if {[focus] == $itk_component(entry)} {
     
    238316        }
    239317    }
     318}
     319
     320# ----------------------------------------------------------------------
     321# CONFIGURATION OPTION: -editable
     322# ----------------------------------------------------------------------
     323itcl::configbody Rappture::Combochecks::editable {
     324    if {![string is boolean -strict $itk_option(-editable)]} {
     325        error "bad value \"$itk_option(-editable)\": should be boolean"
     326    }
     327    _fixState
    240328}
    241329
  • trunk/gui/scripts/controlOwner.tcl

    r5659 r6372  
    6767        integer current
    6868        loader current
     69        multichoice current
    6970        note contents
    7071        number current
  • trunk/gui/scripts/controls.tcl

    r6366 r6372  
    154154        loader {
    155155            Rappture::Loader $w $_owner $path -tool [$_owner tool]
     156            bind $w <<Value>> [itcl::code $this _controlChanged $name]
     157        }
     158        multichoice {
     159            Rappture::MultiChoiceEntry $w $_owner $path
    156160            bind $w <<Value>> [itcl::code $this _controlChanged $name]
    157161        }
  • trunk/gui/scripts/dropdownchecks.tcl

    r5659 r6372  
    3838    public method state {value {newval ""}}
    3939    public method reset {}
     40    public method current {{what -value}}
    4041
    4142    private variable _dispatcher "" ;# dispatcher for !events
     
    280281        set _states($val) 0
    281282    }
     283}
     284
     285# ----------------------------------------------------------------------
     286# USAGE: current ?-value|-label|-both?
     287#
     288# Clients use this to query the current selections from the listbox/canvas.
     289# Returns a list of values, labels, or list of lists of both, according
     290# to the option.
     291# ----------------------------------------------------------------------
     292itcl::body Rappture::Dropdownchecks::current {{what -value}} {
     293    set rlist ""
     294    set l  [llength $_values]
     295    for {set i 0} {$i < $l} {incr i} {
     296        set val [lindex $_values $i]
     297        if {$_states($val)} {
     298            switch -- $what {
     299                -value { lappend rlist [lindex $_values $i] }
     300                -label { lappend rlist [lindex $_labels $i] }
     301                -both  { lappend rlist [list [lindex $_values $i] \
     302                                             [lindex $_labels $i]] }
     303                default {
     304                    error "bad option \"$what\": should be -value, -label, -both"
     305                }
     306            }
     307        }
     308    }
     309    return $rlist
    282310}
    283311
  • trunk/gui/scripts/multichoiceentry.tcl

    r6371 r6372  
    250250    # Assign the default value to this widget, if there is one.
    251251    #
    252     set defval [string trim [$_owner xml get $_path.default]]
    253     if {"" != $defval} {
    254         if {[info exists _str2val($defval)]} {
    255             $itk_component(choice) value $defval
    256         } else {
    257             foreach str [array names _str2val] {
    258                 if {$_str2val($str) == $defval} {
    259                     $itk_component(choice) value $str
    260                     break
    261                 }
    262             }
     252    set defvallist [$_owner xml get $_path.default]
     253    if {"" != $defvallist} {
     254        set v {}
     255        foreach defval [split $defvallist {,}] {
     256            set defval [string trim $defval]
     257            if {[info exists _str2val($defval)]} {
     258                lappend v $defval
     259            } else {
     260                foreach str [array names _str2val] {
     261                    if {$_str2val($str) == $defval} {
     262                        lappend v $str
     263                        break
     264                    }
     265                }
     266            }
     267        }
     268        if {[llength $v] > 0} {
     269            $itk_component(choice) value $v
    263270        }
    264271    }
  • trunk/gui/scripts/page.tcl

    r5659 r6372  
    176176                set type [$obj element -as type]
    177177                switch -- $type {
    178                     number - integer - boolean - choice {
     178                    number - integer - boolean - choice - multichoice {
    179179                        Rappture::ResultViewer $w -width 0 -height 0
    180180                        pack $w -fill x -padx 4 -pady 4
  • trunk/gui/scripts/resultviewer.tcl

    r6052 r6372  
    2626
    2727    constructor {args} {
    28         # defined below
     28        # defined below
    2929    }
    3030    destructor {
     
    395395                    }
    396396                }
    397                 boolean - choice {
     397                boolean - choice - multichoice {
    398398                    set mode "value"
    399399                    if {![info exists _mode2widget($mode)]} {
     
    549549            set dobj [$xmlobj element -as object $path]
    550550        }
    551         number - integer - boolean - choice {
     551        number - integer - boolean - choice - multichoice {
    552552            set dobj [$xmlobj element -as object $path]
    553553        }
  • trunk/lang/tcl/scripts/Makefile.in

    r4209 r6372  
    5757                image \
    5858                integer \
     59                multichoice \
    5960                note \
    6061                number \
  • trunk/lang/tcl/scripts/objects/multichoice/multichoice.rp

    r6371 r6372  
    3535
    3636            # make sure that the default is really a choice
    37             set defval [string trim $attr(default)]
    3837            set found 0
    39             foreach rec $attr(options) {
    40                 set label [string trim [lindex $rec 0]]
    41                 set value [string trim [lindex $rec 1]]
    42                 if {$defval eq $label || $defval eq $value} {
    43                     set found 1
    44                     break
     38            set alldefvals [split $attr(default) ","]
     39            foreach defval $alldefvals {
     40                set defval [string trim $defval]
     41                foreach rec $attr(options) {
     42                    set label [string trim [lindex $rec 0]]
     43                    set value [string trim [lindex $rec 1]]
     44                    if {$defval eq $label || $defval eq $value} {
     45                        incr found
     46                        break
     47                    }
    4548                }
    4649            }
    47             if {!$found} {
    48                 return [list error "Default value must be a label or value for one of the current choices."]
     50            if {$found != [llength $alldefvals]} {
     51                return [list error "Default value must be labels or values from one of the current choices."]
    4952            }
    5053        }
Note: See TracChangeset for help on using the changeset viewer.