I am trying to use a masked TextCtrl that simulates the one in the demo.
My code below works except for one caveat. I want my control to have a
yellow background as soon as the user starts typing in a phone number and
then have the background return to white once the mask has been
successfully filled. What changes to my code do I need?
self.SetCtrlParameters(invalidBackgroundColour = "Yellow") does not work.
Thanks,
-John
import wx
import wx.lib.masked
from runtime_config import runtime_config
from Pines7_wdr import *
class CustTextCtrl_Phone(wx.lib.masked.TextCtrl):
def __init__(self, parent, id, value, pos, size, style ):
wx.lib.masked.TextCtrl.__init__(self, parent, id, value, pos,
size, style, mask = '(###) ###-#### x:#####' )
self.SetCtrlParameters(invalidBackgroundColour = "Yellow")
self.Refresh()
# code to change the font size...
runcfg = runtime_config()
self.SetFont( wx.Font( runcfg.get_font_pointSize(),
runcfg.get_font_family(),
runcfg.get_font_style(), runcfg.get_font_weight() ) )