Changeset 3040 for trunk/gui/scripts


Ignore:
Timestamp:
Jun 13, 2012, 8:06:54 PM (12 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r3038 r3040  
    7272    private method XmlGetSubst { path }
    7373    private method Withdraw {}
     74    private method WatchHotspot { w item x y }
    7475}
    7576
     
    596597        "font"          "-font"
    597598        "color"         "-foreground"
     599        "valuecolor"    "-valueforeground"
    598600        "text"          "-text"
    599601        "anchor"        "-anchor"
     
    604606    array set options {
    605607        -font {Arial 8}
     608        -valuefont {Arial 8 bold}
     609        -valueforeground blue3
    606610        -text {}
    607611        -fill {}
     
    635639    set _cname2id($cname) $id
    636640    eval $itk_component(drawing) itemconfigure $id [array get options]
     641    foreach varName [Rappture::hotspot variables $itk_component(drawing) $id] {
     642        if { [info exists _name2path($varName)] } {
     643            set path $_name2path($varName)
     644            $_owner xml put $path.hide 1
     645        } else {
     646            puts stderr "unknown varName=$varName"
     647        }
     648    }
     649    $itk_component(drawing) bind $id <Motion> \
     650        [itcl::code $this WatchHotspot %W $id %x %y]
     651}
     652
     653
     654itcl::body Rappture::DrawingEntry::WatchHotspot { w item x y } {
     655    set x [$w canvasx $x]
     656    set y [$w canvasy $y]
     657    set varName  [Rappture::hotspot identify $w $item $x $y]
     658    puts stderr "x=$x y=$y [$w itemcget $item -text] varName=$varName"
     659    $w itemconfigure $item -activevalue $varName
    637660}
    638661
     
    914937itcl::body Rappture::DrawingEntry::XmlGet { path } {
    915938    set value [$_owner xml get $path]
    916     if { $_parser == "" } {
    917         return $value
    918     }
    919     return $value
     939    return [string trim $value]
    920940}
    921941
     
    925945        return $value
    926946    }
    927     return [$_parser eval [list subst -nocommands $value]]
    928 }
     947    return [string trim [$_parser eval [list subst -nocommands $value]]]
     948}
Note: See TracChangeset for help on using the changeset viewer.