X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8eca4fef106b8327e2e55636de3f68a511a4c392..6d99eb3e379fc5cdb835f9a87f92b612ec58dd1c:/wxPython/demo/TextCtrl.py diff --git a/wxPython/demo/TextCtrl.py b/wxPython/demo/TextCtrl.py index 77fc77b9e5..003c100da7 100644 --- a/wxPython/demo/TextCtrl.py +++ b/wxPython/demo/TextCtrl.py @@ -22,7 +22,7 @@ class TestPanel(wx.Panel): l1 = wx.StaticText(self, -1, "wx.TextCtrl") t1 = wx.TextCtrl(self, -1, "Test it out and see", size=(125, -1)) - t1.SetInsertionPoint(0) + wx.CallAfter(t1.SetInsertionPoint, 0) self.tc1 = t1 self.Bind(wx.EVT_TEXT, self.EvtText, t1) @@ -39,10 +39,12 @@ class TestPanel(wx.Panel): t3 = wx.TextCtrl(self, -1, "Here is a looooooooooooooong line of text set in the control.\n\n" "The quick brown fox jumped over the lazy dog...", - size=(200, 100), style=wx.TE_MULTILINE) + size=(200, 100), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER) t3.SetInsertionPoint(0) self.Bind(wx.EVT_TEXT, self.EvtText, t3) + self.Bind(wx.EVT_TEXT_ENTER, self.EvtTextEnter, t3) + b = wx.Button(self, -1, "Test Replace") self.Bind(wx.EVT_BUTTON, self.OnTestReplace, b) b2 = wx.Button(self, -1, "Test GetSelection") @@ -92,6 +94,9 @@ class TestPanel(wx.Panel): def EvtText(self, event): self.log.WriteText('EvtText: %s\n' % event.GetString()) + def EvtTextEnter(self, event): + self.log.WriteText('EvtTextEnter\n') + event.Skip() def EvtChar(self, event): self.log.WriteText('EvtChar: %d\n' % event.GetKeyCode())