Philippe Ney wrote:
Hi,
I have a dialog with wxListCtrls, buttons and one wxTextCtrl.
I want that when the dialog opens, the focus is set on one of the wxListCtrls.
This to move between items only using the arrow keys
In this way, I try the two following idea :1) In the __init__ of the dialog class
self.myListCtrl.SetFocus ()
2) making myListCtrl an object of a custom list ctrl class derived from
wxListCtrl with the following select method that I also call in the init
of the dialog.
[...]
But none of this two method works....
The focus always stay in the wxTextCtrlI wonder if this was due to some behavior of input widget to steal the focus?
No, it's just the way dialogs work. They set the focus to the first widget when ShowModal is called.
You can use wxCallAfter to cause the call to SetFocus to happen after the modal event loop has been started.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!