Changeset 1425

Show
Ignore:
Timestamp:
10/08/05 17:32:00 (3 years ago)
Author:
ed
Message:

Fixed the spinner so that changing the value via the textbox portion raises a Hit event as long as the text is a valid value.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dSpinner.py

    r1415 r1425  
    2020        super(dSpinner, self)._initEvents() 
    2121        self.Bind(wx.EVT_SPINCTRL, self._onWxHit) 
     22        self.Bind(wx.EVT_TEXT, self._onWxText) 
    2223         
    2324 
     
    3233        original = list(super(dSpinner, self)._getInitPropertiesList()) 
    3334        return tuple(original + additional) 
     35         
     36     
     37    def _onWxText(self, evt): 
     38        if evt.IsChecked(): 
     39            # If the user enters invalid text in the text field, IsChecked() 
     40            # will return False, so we know to ignore the input. 
     41            self.raiseEvent(dabo.dEvents.Hit, evt) 
    3442         
    3543         
     
    7886        "Specifies whether the spinner value wraps at the high/low value. (bool)") 
    7987 
     88 
    8089class _dSpinner_test(dSpinner): 
    8190    def initProperties(self): 
     
    8493        self.SpinnerWrap = True 
    8594 
     95    def onHit(self, evt): 
     96        print "HIT!", self.Value 
     97         
     98 
    8699if __name__ == "__main__": 
    87100    import test