from wxPython.wx import *
class MyTextCtrl(wxTextCtrl):
def __init__(self, parent, id):
wxTextCtrl.__init__(self, parent, id,
style = wxTE_PROCESS_ENTER)
EVT_CHAR(self, self.OnChar)
EVT_TEXT_ENTER(self, self.GetId(), self.OnEnter)
def OnChar(self, event):
print "type a char"
print "MyTextCtrl", event
event.Skip()
def OnEnter(self, event):
print "pressed enter"
print "MyTextCtrl", event
event.Skip()
class MyPanel(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id)
child = MyTextCtrl(self, -1)
class MyFrame(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, -1, title)
self.panel = MyPanel(self, -1)
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(None, -1, "")
frame.Show(true)
return true
app = MyApp()
app.MainLoop()
···
On Tue, 2002-12-10 at 13:58, Anders Bruun Olsen wrote:
On Mon, Dec 09, 2002 at 09:27:16PM +0100, Anders Bruun Olsen wrote:
> I would like to do one thing when enter is pressed in a wxTextCtrl and
> something else when shift-enter is pressed.
> How can I do that?
> I would also like to do something similar in a wxTreeCtrl..
Should I interpret the complete lack of responses as there is no way to
do this??
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308