[wxPython] wxTextCtrl and Tab Key

I'd like to be able to enter tabs in a wxTextCtrl. Now when I press tab, the focus moves to the next control on the form. I'm using win98 and wxpython 2.1.15

Anyone know how to do that?

Thanks,

Gene

···

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

Use the wxTE_PROCESS_TAB style, e.g.

myTextCtrl = wxTextCtrl(self, id, "Hello", style = wxTE_PROCESS_TAB)
EVT_CHAR(myTextCtrl, myTextCtrlEvtChar)

def myTextCtrlEvtChar(self, event):
    print 'Keypress is %d' % event.KeyCode()

Note that the default handling for tab is still to move to the next control,
so if you want to prevent this, you have to override the default character
event handler using EVT_CHAR, like shown above. Setting wxTE_PROCESS_TAB
just makes sure that the tab is handled by the event handler.

Robert Cragie

···

-----Original Message-----
From: wxpython-users-admin@wxwindows.org
[mailto:wxpython-users-admin@wxwindows.org]On Behalf Of Gene Chiaramonte
Sent: 07 June 2000 01:22
To: wxpython-users
Subject: [wxPython] wxTextCtrl and Tab Key

I'd like to be able to enter tabs in a wxTextCtrl. Now when I
press tab, the focus moves to the next control on the form. I'm
using win98 and wxpython 2.1.15

Anyone know how to do that?

Thanks,

Gene
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

_______________________________________________
wxPython-users mailing list wxPython-users@wxwindows.org
http://wxwindows.org/mailman/listinfo/wxpython-users

En r�ponse � Gene Chiaramonte <gchiaramonte@mail.com>:

I'd like to be able to enter tabs in a wxTextCtrl. Now when I press tab,
the focus moves to the next control on the form. I'm using win98 and
wxpython 2.1.15

Anyone know how to do that?

From the doc :

Window styles

* wxTE_PROCESS_ENTER :
The control will generate the message wxEVENT_TYPE_TEXT_ENTER_COMMAND (otherwise
pressing <Enter> is either processed internally by the control or used for
navigation between dialog controls).

* wxTE_PROCESS_TAB :
The control will receieve EVT_CHAR messages for TAB pressed - normally, TAB is
used for passing to the next control in a dialog instead. For the control
created with this style, you can still use Ctrl-Enter to pass to the next
control from the keyboard.

Alexandre Fayolle
http://alexandre.fayolle.free.fr