Changeset 2631


Ignore:
Timestamp:
Jan 14, 2017 3:17:57 PM (5 years ago)
Author:
toby
Message:

unselect invalid text in ValidatedTxtCtrl? to bypass Linux bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r2622 r2631  
    508508        'Set the control colors to show invalid input'
    509509        if self.invalid:
     510            ins = self.GetInsertionPoint()
    510511            self.SetForegroundColour("red")
    511512            self.SetBackgroundColour("yellow")
    512513            self.SetFocus()
    513             self.Refresh()
     514            self.Refresh() # this selects text on some Linuxes
     515            self.SetSelection(0,0)   # unselect
     516            self.SetInsertionPoint(ins) # put insertion point back
    514517        else: # valid input
    515518            self.SetBackgroundColour(
     
    733736        '''
    734737        if tc.invalid:
     738            ins = tc.GetInsertionPoint()
    735739            tc.SetForegroundColour("red")
    736740            tc.SetBackgroundColour("yellow")
    737741            tc.SetFocus()
    738             tc.Refresh()
     742            tc.Refresh() # this selects text on some Linuxes
     743            tc.SetSelection(0,0)   # unselect
     744            tc.SetInsertionPoint(ins) # put insertion point back
    739745            return False
    740746        else: # valid input
Note: See TracChangeset for help on using the changeset viewer.