Changeset 1989


Ignore:
Timestamp:
Oct 6, 2015 5:48:53 PM (6 years ago)
Author:
toby
Message:

fix ValidatedTxtCtrl? bug; add option to G2CheckBox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r1971 r1989  
    308308        self.OnLeaveArgs = OnLeaveArgs
    309309        self.CIFinput = CIFinput
     310        self.notBlank = notBlank
    310311        self.type = str
    311312        # initialization
     
    464465        '''
    465466        val = self.GetValue().strip()
    466         self.invalid = not val
     467        if self.notBlank:
     468            self.invalid = not val
     469        else:
     470            self.invalid = False
    467471        self._IndicateValidity()
    468472        if self.invalid:
     
    962966      The CheckBox will be initialized from this value.
    963967      If the value is anything other that True (or 1), it will be taken as
    964       False.
     968      False.
     969    :param function OnChange: specifies a function or method that will be
     970      called when the CheckBox is changed (Default is None).
     971      The called function is supplied with one argument, the calling event.
    965972    '''
    966     def __init__(self,parent,label,loc,key):
     973    def __init__(self,parent,label,loc,key,OnChange=None):
    967974        wx.CheckBox.__init__(self,parent,id=wx.ID_ANY,label=label)
    968975        self.loc = loc
    969976        self.key = key
     977        self.OnChange = OnChange
    970978        self.SetValue(self.loc[self.key]==True)
    971979        self.Bind(wx.EVT_CHECKBOX, self._OnCheckBox)
     
    973981        self.loc[self.key] = self.GetValue()
    974982        log.LogVarChange(self.loc,self.key)
    975            
     983        if self.OnChange: self.OnChange(event)
     984                   
    976985################################################################################
    977986#### Commonly used dialogs
Note: See TracChangeset for help on using the changeset viewer.