Hi,
I’m trying to use a SearchCtrl widget on OS X as in the example below. On pressing enter, nothing happens. However, if I replace wx.SearchCtrl with wx.TextCtrl, “You pressed enter!” is printed as expected…
Output from wx.version() = 2.9.2.4 osx-cocoa (classic)
I’ve read through all the documentation I can find… initially I was missing the style=wx.TE_PROCESS_ENTER, which fixed things for the TextCtrl, but I can’t find anything more for the SearchCtrl, they appear to be near identical widgets!
Any help would be VERY much appreciated!
Thanks!
Dan
···
######################################################################
#!/usr/bin/python
-- coding: iso-8859-1 --
try:
import wx
wx.
except ImportError:
raise ImportError,“The wxPython module is required to run this program”
class simpleapp_wx(wx.Frame):
def init(self,parent,id,title):
wx.Frame.init(self,parent,id,title)
self.parent = parent
self.initialize()
def initialize(self):
self.entry = wx.SearchCtrl(self,-1,value=u"Enter text here.",style=wx.TE_PROCESS_ENTER)
self.Bind(wx.EVT_TEXT_ENTER, self.OnPressEnter, self.entry)
self.Show(True)
def OnPressEnter(self,event):
print “You pressed enter !”
if name == “main”:
app = wx.App()
frame = simpleapp_wx(None,-1,‘my application’)
app.MainLoop()