wx.EVT_TEXT_ENTER

Hi Aigars,

Aigars:
> looks like wx.EVT_TEXT_ENTER does not happens.

Robin Dunn:
> Which version of wxPython? Can you make a small sample that shows the
> problem?

Aigars:

wxGTK-2.8.7 and wxPython-2.8.7.1, both installed seperately. wxGTK first.

You need to pass wx.TE_PROCESS_ENTER style to your wx.TextCtrl,
otherwise no processing of the "Enter" key is possible.

There is code sample:

import wx

class Form_Main(wx.Frame):
   def __init__(self, *args, **kwds):
       # begin wxGlade: Form_Main.__init__
       kwds["style"] = wx.DEFAULT_FRAME_STYLE
       wx.Frame.__init__(self, *args, **kwds)
       self.SetTitle("wx.EVT_TEXT_ENTER doesnot happens :frowning: ")
       self.SetSize((900, 500))

       self.panel_1 = wx.Panel(self, -1)
       self.panel_1.SetMinSize((300, 100))

       self.label_Date = wx.StaticText(self.panel_1, -1, "Date...")
       self.label_Date.SetMinSize((80, 15))
       self.text_Date = wx.TextCtrl(self.panel_1, -1, "")

self.text_Date = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_PROCESS_ENTER)

       self.text_Date.SetMinSize((80, 20))
       self.text_Date.Bind(wx.EVT_TEXT_ENTER, self.text_Date_update ,
self.text_Date)

       sizer_Date = wx.BoxSizer(wx.HORIZONTAL)
       sizer_Date.Add(self.label_Date, 0, wx.ALL, 5)
       sizer_Date.Add(self.text_Date, 0, wx.ALL|wx.ALIGN_RIGHT, 5)

       self.panel_1.SetSizer(sizer_Date)

   def text_Date_update():
       print self.text_Date.GetValue()

class MyApp(wx.App):
   def OnInit(self):
       wx.InitAllImageHandlers()
       GLapp = Form_Main(None, -1, "")
       self.SetTopWindow(GLapp)
       GLapp.Show()
       return 1

# end of class MyApp

if __name__ == "__main__":
   app = MyApp(0)
   app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Feb 5, 2008 4:46 PM, Aigars wrote:

Aigars wrote:

You need to pass wx.TE_PROCESS_ENTER style to your wx.TextCtrl,
otherwise no processing of the "Enter" key is possible.

self.text_Date = wx.TextCtrl(self.panel_1, -1, "",

style=wx.TE_PROCESS_ENTER)

Thank you, now it looks like working.

Some more questions:
1) No wx.TE_PROCESS_ENTER was needed on Windows version of wxPython. If I rewrite code with wx.TE_PROCESS_ENTER, will it work on Windows?

Yes, and there are probably some situations where it would be required like on the other platforms.

2) If i want to confirm update of TextCtrl with any of keys [Tab, Enter, Arrow] what I should pass to TextCtrl before that?

wx.WANTS_CHARS will probably do it.

···

On Tuesday 05 February 2008 19:13:48 Andrea Gavana wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!