Hi wxPython users:
I'm not sure if this is a feature, or a bug. I have a Grid control and TextCtrl on the same panel. I expect the focus to shift to the Grid control when the user clicks on a row or column label, but it does not. Keyboard operations are still directed to the last active control, which is a TextCtrl in my case. As a result, a Grid row is highlighted, but keystrokes that might be necessary to operate on the Grid (e.g. CTRL-C to copy a row) are directed to the TextCtrl. The user does not expect this and is shocked to see the text control changed when they thought they were working on the Grid control.
This issue has been reported before on this group:
https://groups.google.com/forum/?fromgroups#!searchin/wxpython-users/grid$20set$20focus/wxpython-users/QL0lKmY2LoM/mM8zkG-LOQMJI have attached the code from the aforementioned post, modified just slightly, to reproduce the problem. Run App1.py and note the TextCtrl has the focus. Click a grid row label and note the TextCtrl still has focus. Now press an alpha-numeric key and observe the character is inserted in the TextCtrl.
To work around the "problem", I call Grid.SetFocus() in mouse click event handlers. To see this, uncomment the code beneath the UNCOMMENT TO FIX comment.
Is this a feature or a bug?
Environment: Windows XP, wxPython 2.8.12.1, Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Thanks.