Ignore:
Timestamp:
May 9, 2006 5:56:32 PM (18 years ago)
Author:
mmc
Message:

Fixed the <sequence> object so that it can support multiple objects
within each <element>. For example, the zoo/sequence demo now includes
two parameters A and B, and the B parameters are used to generate a
series of <curve> objects within each <element>.

Fixed the <sequence> so it works correctly when an index has units.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/sequence.tcl

    r428 r435  
    5151        }
    5252
     53        set ctype ""
     54        set _dataobjs($index) ""
    5355        foreach cname [$_xmlobj children $name] {
    5456            set type [$xmlobj element -as type $path.$name.$cname]
     
    5658                index {
    5759                    # ignore this
     60                    continue
    5861                }
    5962                curve {
    6063                    set obj [Rappture::Curve ::#auto $xmlobj $path.$name.$cname]
    61                     break
    6264                }
    6365                field {
    6466                    set obj [Rappture::Field ::#auto $xmlobj $path.$name.$cname]
    65                     break
    6667                }
    6768                image {
    6869                    set obj [Rappture::Image ::#auto $xmlobj $path.$name.$cname]
    69                     break
    7070                }
    7171                default {
     
    7373                }
    7474            }
     75            if {"" == $ctype} {
     76                set ctype $type
     77            }
     78            if {$type == $ctype} {
     79                lappend _dataobjs($index) $obj
     80            } else {
     81                itcl::delete object $obj
     82            }
    7583        }
    76         set _dataobjs($index) $obj
    7784    }
    7885
     
    8087    # Generate a list of sorted index values.
    8188    #
    82     set units [$xmlobj get path.index.units]
     89    set units [$xmlobj get $path.index.units]
    8390    if {"" != $units} {
    8491        # build up a list:  {10m 10} {10cm 0.1} ...
     
    125132itcl::body Rappture::Sequence::destructor {} {
    126133    foreach key [array names _dataobjs] {
    127         itcl::delete object $_dataobjs($key)
     134        eval itcl::delete object $_dataobjs($key)
    128135    }
    129136    itcl::delete object $_xmlobj
Note: See TracChangeset for help on using the changeset viewer.