Attached is an example of a piece of coding that we are using to have mailaddresses apear automagically when a user starts typing part of a mailaddress.
The list appears nicely, and the users can select a mailaddress
However, the problem is that, the focus does NOT return to the textctrl. which means that the users cannot continue typing without first selecting the textcontrol again. I have tried with CallAfter and with Yield, nothing seems to work. Also, when the window with the listbox is shown somewhere else (outside the mainwindow) it seems to work OK.
Is there any way to have the focus return to the TextControl?
Since you are using a frame for the popup then it will by default be getting the focus when it is activated. You'll need to Raise the main window to get it activated again, and then widgets within it will be able to have the focus. However getting the timing right on that may be tricky, and since the FRAME_FLOAT_ON_PARENT style is being used then Raise may not work as expected anyway, depending on the platform. Another potential complication in your sample is that you are creating a new popup frame for every character typed, and I don't see any place where you close them.
You should try using wx.PopupWindow or wx.PopupTransientWindow instead of using a frame for the popup, they are made for doing this type of thing.
···
On 10/26/12 5:45 AM, Dick Kniep wrote:
However, the problem is that, the focus does NOT return to the textctrl.
which means that the users cannot continue typing without first
selecting the textcontrol again. I have tried with CallAfter and with
Yield, nothing seems to work. Also, when the window with the listbox is
shown somewhere else (outside the mainwindow) it seems to work OK.
Is there any way to have the focus return to the TextControl?