Try the following code and see if it behaves as you intend. Ether
TAB or ENTER will process the text and go on to the next textctrl.
If this is what you want, you will need to look up Surviving with
wxEVT_KILL_FOCUS under Microsoft Windows at:
http://wxpython.org/cgi-bin/wiki/wxPython_20Cookbook
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self, parent=None, id=-1, title='Process Tab'):
wxFrame.__init__(self, parent, id, title)
panel = wxPanel(self, -1)
t1 = wxTextCtrl(panel, 10, '',
wxDefaultPosition,
wxDefaultSize)
t2 = wxTextCtrl(panel, 20, '',
wxDefaultPosition,
wxDefaultSize)
t3 = wxTextCtrl(panel, 30, '',
wxDefaultPosition,
wxDefaultSize)
EVT_KILL_FOCUS(t1, self.OnLeave)
EVT_KILL_FOCUS(t2, self.OnLeave)
EVT_KILL_FOCUS(t3, self.OnLeave)
# the rest of this is to control the frame layout
box0 = wxBoxSizer(wxVERTICAL)
box0.Add(t1, 0, wxEXPAND)
box0.Add(t2, 0, wxEXPAND)
box0.Add(t3, 0, wxEXPAND)
panel.SetSizer(box0)
panel.Layout()
panel.SetAutoLayout(true)
box0.Fit(self)
box0.SetSizeHints(self)
def OnLeave(self, event):
t = event.GetEventObject()
print ('Text: %s\n' % t.GetValue())
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame()
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
···
--- Peter Moscatt <pmoscatt@yahoo.com> wrote:
How can I capture the ENTER key event (when it's
pressed) then simulate the TAB key so when I ender
data into a wxTextCtrl then press ENTER it will then
jump to the next control ?
=====
Donnal Walter
Arkansas Children's Hospital
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com