Problem with Navigation command
Hofer, Greg
Greg.Hofer at gdcanada.com
Thu Aug 2 14:28:36 PDT 2007
WX: 2.8.4
OS: Linux
COMPILER: GCC - using makefile
I am wondering how the Navigate command should work. I have a simple
panel with 4 single-line text controls. I have a function that gets
called on an EVT_SET_FOCUS event where I simply print the window id that
has focus. When I TAB between fields, the window id goes from 203 to
206 and then back to 203. When I use the mouse and click on a specific
field, the correct window id is printed. I also have a function that
captures the Enter key and it calls the "Navigate" method. However,
this does not necessarily cause the focus to move to the next field.
Here's an example:
Panel with 4 text fields:
--------------------------
Text Field - Window Id 203
Text Field - Window Id 204
Text Field - Window Id 205
Text Field - Window Id 206
If I click on text field 203, then 204, then 205, and then back to 204
and then I hit enter to trigger the Navigate call, field 203 gets focus.
Why would this be? Shouldn't field 205 always get focus next? If I
just click on field 203 and then hit Enter, the Navigate command seems
to work properly and it will move the fields in order. Any thoughts
would be appreciated. Thanks.
Code fragments below for my TextCtrl class:
// Event table definition for the class
BEGIN_EVENT_TABLE(MPAStextCtrl, wxTextCtrl)
EVT_TEXT_ENTER(-1, MPAStextCtrl::onEnter)
EVT_SET_FOCUS(MPAStextCtrl::onGotFocus)
END_EVENT_TABLE()
void MPAStextCtrl::onGotFocus (wxFocusEvent& event)
{
wxWindow* win = FindFocus();
printf ("window %d has got focus\n", win->GetId());
}
void MPAStextCtrl::onEnter(wxCommandEvent& event)
{
printf ("enter key\n");
Navigate();
}
Greg
!!! Ignore warning below saying e-mail is private !!!
The information contained in this e-mail message is PRIVATE. It may contain confidential information and may be legally privileged. It is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any dissemination, distribution or reproduction of this communication is strictly prohibited. If the intended recipient(s) cannot be reached or if a transmission problem has occurred, please notify the sender immediately by return e-mail and destroy all copies of this message.
Thank you.
More information about the wx-users
mailing list