I'm trying to change the tab order of some text controls.
Searching the lists, I found a note saying that tab order can't be
changed, but you could manipulate the list returned by
wxWindow::GetChildren().
In c++, it is a reference to the window's children (a wxList).
In python, it is a python list, and I suppose it is a copy of the c++
list. Thus, changing this list seems not to have any effect in the real
children list.
So, I'm stuck with my original problem, ¿How to change the tab order?
I know it is defined by widget creation, but I have a dialog with 2
wxTextCtrl's, some buttons and a spin button that allows the user to add
more wxTextCtrls.
When the user click the spin button, I add more wxTextCtrls in the
appropiated location within the widget. Everything is fine, except for
the tab order.
You can change the tab order after controls are created by hiding and then
showing controls. The simplest thing to do is hide all the controls, then
show the controls in the new order. Use Freeze/Thaw to avoid a screen update
during the Show(0) (hide) and Show(), wx.wxWindow_FindFocus() to get the
focused item prior to doing a Show(0) and SetFocus() after all the controls
are visible again. Actually, the focus calls might not be necessary, you'll
have to experiment.
This is a hack and as such could stop working with a future version of
wxPython, but it does work for 2.3.2.1 and 2.3.3. Note that this is also a
nasty side-effect if you hide/show for other purposes and get changed tab
order when you didn't want it.
A more generic solution, which is probably what wxWindows should implement
is to have a default handler for the kill focus event that checks a tab
order list and sets the focus to the next control in the list. I'm sure it
is a bit more complicated than that since tab order has been on the feature
request list for a long time and various hack solutions have been suggested
periodically. This is definitely an issue that needs to be resolved prior to
version 2.4
ka
···
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Juan Pablo
Romero
Sent: Thursday, August 29, 2002 9:56 AM
To: wxpython-users@lists.wxwindows.org
Subject: [wxPython] wxWindow::GetChildren()
Hi!
I'm trying to change the tab order of some text controls.
Searching the lists, I found a note saying that tab order can't be
changed, but you could manipulate the list returned by
wxWindow::GetChildren().
In c++, it is a reference to the window's children (a wxList).
In python, it is a python list, and I suppose it is a copy of the c++
list. Thus, changing this list seems not to have any effect in the real
children list.
So, I'm stuck with my original problem, ¿How to change the tab order?
I know it is defined by widget creation, but I have a dialog with 2
wxTextCtrl's, some buttons and a spin button that allows the user to add
more wxTextCtrls.
When the user click the spin button, I add more wxTextCtrls in the
appropiated location within the widget. Everything is fine, except for
the tab order.
I'm trying to change the tab order of some text controls.
Searching the lists, I found a note saying that tab order can't be
changed, but you could manipulate the list returned by
wxWindow::GetChildren().
In c++, it is a reference to the window's children (a wxList).
In python, it is a python list, and I suppose it is a copy of the c++
list. Thus, changing this list seems not to have any effect in the real
children list.
So, I'm stuck with my original problem, �How to change the tab order?
I'm afraid that there is no way currently other than destroying and
recreating all the controls. I have on my list to change the object
wxWindow::GetChildren returns so it can manipulate the original list, but I
probably won't get to that until after 2.3.3.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!