Changeset 1262


Ignore:
Timestamp:
Mar 25, 2014 5:06:13 PM (8 years ago)
Author:
toby
Message:

change validated text control so that SetValue? stores the result

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1259 r1262  
    262262                **kw)
    263263            if val is not None:
    264                 self.SetValue(val)
     264                self._setValue(val)
    265265            else: # no default is invalid for a number
    266266                self.invalid = True
     
    277277                **kw)
    278278            if val is not None:
    279                 self.SetValue(val)
     279                self._setValue(val)
    280280            else:
    281281                self.invalid = True
     
    309309
    310310    def SetValue(self,val):
     311        if self.result is not None: # note that this bypasses formatting
     312            self.result[self.key] = val
     313        self._setValue(val)
     314
     315    def _setValue(self,val):
    311316        self.invalid = False
    312317        if self.type is int:
     
    405410            self.EvaluateExpression()
    406411        elif self.result is not None: # show formatted result, as Bob wants
    407             self.SetValue(self.result[self.key])
     412            self._setValue(self.result[self.key])
    408413        if self.OnLeave: self.OnLeave(invalid=self.invalid,
    409414                                      value=self.result[self.key],
     
    415420            self.EvaluateExpression()
    416421        elif self.result is not None: # show formatted result, as Bob wants
    417             self.SetValue(self.result[self.key])
     422            self._setValue(self.result[self.key])
    418423
    419424    def EvaluateExpression(self):
     
    426431        if not self.evaluated: return # true when an expression is evaluated
    427432        if self.result is not None: # retrieve the stored result
    428             self.SetValue(self.result[self.key])
     433            self._setValue(self.result[self.key])
    429434        self.evaluated = False # expression has been recast as value, reset flag
    430435       
     
    14711476        # OK done, let's get outa here
    14721477        self.SetSizer(Sizer)
     1478        self.CenterOnParent()
    14731479    def GetSelections(self):
    14741480        'Returns a list of the indices for the selected choices'
Note: See TracChangeset for help on using the changeset viewer.