SetFocus in EVT_TEXT handler clears SearchCtrl text (wxPython 3.0.0.0)

See attached example code.
In my real app, I am using a SearchCtrl for incremental search by adding a handler for EVT_TEXT.

Strangely, calling SetFocus in the EVT_TEXT handler clears the SearchCtrl text except for the last character typed.

Remove the SetFocus call and it works.

Calling SetFocus from an EVT_TEXT handler used to work in wxPython 2.9.

In my real app, sometimes the search brings up another window that grabs the focus.

I want to bring it back to the SearchCtrl to continue the incremental search, hence the need for a call to SetFocus in the EVT_TEXT handler.

Suggestions? A bug that crept in?

search_bug.py (951 Bytes)

Add self.search.SetInsertionPointEnd() after self.search.SetFocus() . When SetFocus() is called, the whole text in the TextCtrl is marked. Weh you then just type, the marked text will be replaced.

ยทยทยท

Am Sonntag, 27. April 2014 13:56:38 UTC+2 schrieb Edward Sitarski:

See attached example code.
In my real app, I am using a SearchCtrl for incremental search by adding a handler for EVT_TEXT.

Strangely, calling SetFocus in the EVT_TEXT handler clears the SearchCtrl text except for the last character typed.

Remove the SetFocus call and it works.

Calling SetFocus from an EVT_TEXT handler used to work in wxPython 2.9.

In my real app, sometimes the search brings up another window that grabs the focus.

I want to bring it back to the SearchCtrl to continue the incremental search, hence the need for a call to SetFocus in the EVT_TEXT handler.

Suggestions? A bug that crept in?