Ignore:
Timestamp:
Oct 23, 2009, 3:37:28 PM (15 years ago)
Author:
gah
Message:

don't use: broken xyresult print

File:
1 edited

Legend:

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

    r1342 r1588  
    4141    public method value {args}
    4242    public method translate {value}
     43    public method label {value}
     44    public method current {}
    4345    public method choices {option args}
    4446
     
    5355           0xfe, 0x7c, 0x38, 0x10};
    5456    }
     57    private variable _value2label
     58    private variable _label2value
    5559}
    5660                                                                               
     
    153157    }
    154158    return ""
     159}
     160
     161# ----------------------------------------------------------------------
     162# USAGE: label <value>
     163#
     164# Clients use this to translate a value to a label.
     165# ----------------------------------------------------------------------
     166itcl::body Rappture::Combobox::label { myValue } {
     167    foreach {val label} [choices get -both] {
     168        if {$myValue == $val} {
     169            return $label
     170        }
     171    }
     172    return ""
     173}
     174
     175# ----------------------------------------------------------------------
     176# USAGE: getValue <value>
     177#
     178# Clients use this to translate a value to a label.
     179# ----------------------------------------------------------------------
     180itcl::body Rappture::Combobox::current {} {
     181    return [translate [$itk_component(entry) get]]
    155182}
    156183
Note: See TracChangeset for help on using the changeset viewer.