Problem with auto-selection in wx masked control

jean-michel bain-cornu jmbc at nospam.fr
Mon Dec 12 22:21:16 CET 2005


Hi all,

I'm trying to get the whole field selected when the caret arrives into a 
wx masked control.
This is perfectly done with the program below.
But if I comment out the line "r= dlg.ShowModal()", I get something 
different : the data within the field is no more correctly selected.
Why ? And is there any solution ?
If somebody have got an idea, I'd be delighted.

Cheers,
jm

#------------------------------------------------------------------------
import  wx
from wx.lib import masked
#--
class TestPanel( wx.Panel ):
     def __init__( self, parent):
         wx.Panel.__init__( self, parent, -1 )
         self.mask1 = masked.NumCtrl( self, -1, name="target control", 
pos=(20,50))
         self.mask1.SetSelectOnEntry(True)
         self.mask1.SetValue(123.45678)
         self.Show()
#--
class MainWindow(wx.Frame):
     def __init__(self,parent,id, title):
         wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200 ,200))
         win = TestPanel(self)
         dlg = wx.MessageDialog(self, 'Confirm')
         r= dlg.ShowModal()
         dlg.Destroy()
         self.Show()
#--
app = wx.PySimpleApp()
frame=MainWindow(None,-1,'')
app.MainLoop()
#------------------------------------------------------------------------



More information about the Python-list mailing list