Ignore:
Timestamp:
Feb 17, 2015 5:49:36 PM (9 years ago)
Author:
mmh
Message:

puq integration snap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/uq/gui/scripts/numberentry.tcl

    r3647 r5029  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: NumberEntry - widget for entering numeric values
     
    2525    public method label {}
    2626    public method tooltip {}
    27 
    2827    protected method _newValue {}
    2928
     
    4342# ----------------------------------------------------------------------
    4443itcl::body Rappture::NumberEntry::constructor {owner path args} {
     44    puts "NumberEntry '$path' '$args'"
     45    set varname [lindex [split $path ()] 1]
     46
    4547    if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} {
    4648        error "bad object \"$owner\": should be Rappture::ControlOwner"
     
    4850    set _owner $owner
    4951    set _path $path
    50    
     52
     53    puts "LABEL=[label]"
    5154    #
    5255    # Figure out what sort of control to create
     
    5861        lappend presets $value $label
    5962    }
    60    
     63
    6164    set class Rappture::Gauge
    6265    set units [string trim [$_owner xml get $path.units]]
     66    puts "units=$units"
    6367    if {$units != ""} {
    6468        set desc [Rappture::Units::description $units]
     
    6771        }
    6872    }
    69    
     73
    7074    #
    7175    # Create the widget and configure it properly based on other
     
    7377    #
    7478    itk_component add gauge {
    75         $class $itk_interior.gauge -units $units -presets $presets -log $path
     79        $class $itk_interior.gauge -units $units -presets $presets -log $path -varname $varname -label [label]
    7680    }
    7781    pack $itk_component(gauge) -expand yes -fill both
    7882    bind $itk_component(gauge) <<Value>> [itcl::code $this _newValue]
    79    
     83
    8084    set min [string trim [$_owner xml get $path.min]]
    81     if {$min ne ""} { 
    82         $itk_component(gauge) configure -minvalue $min 
    83     }
    84    
     85    if {$min ne ""} {
     86        $itk_component(gauge) configure -minvalue $min
     87    }
     88
    8589    set max [string trim [$_owner xml get $path.max]]
    86     if {$max ne ""} { 
    87         $itk_component(gauge) configure -maxvalue $max 
     90    if {$max ne ""} {
     91        $itk_component(gauge) configure -maxvalue $max
    8892    }
    8993
     
    119123    #
    120124    set str [string trim [$_owner xml get $path.default]]
    121     if {$str ne ""} {
    122         $itk_component(gauge) value $str
     125    puts "Default=$str"
     126    if {$str ne ""} {
     127        $itk_component(gauge) value $str
    123128    }
    124129}
Note: See TracChangeset for help on using the changeset viewer.