Fix handling TAB in wxSearchCtrl in wxMSW
Check whether wxTextCtrl has focus using Win32 ::GetFocus() instead of by comparing FindFocus() with "this" pointer, as the latter fails when wxTextCtrl is part of a composite control, such as wxSearchCtrl. This is enough to make pressing TAB in wxSearchCtrl correctly go to the next control instead of just beeping. Note that we could also use DoFindFocus() here, but this would be needlessly less efficient as we don't really need to find wxWindow corresponding to the focused HWND, as that function does. But we can't use HasFocus() here as it wouldn't work correctly here when the focus is on another sub-window of a composite control also containing this wxTextCtrl.
This commit is contained in:
@@ -2078,7 +2078,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
// forces at the moment unfortunately
|
||||
if ( !(m_windowStyle & wxTE_PROCESS_TAB))
|
||||
{
|
||||
if ( FindFocus() == this )
|
||||
if ( ::GetFocus() == GetHwnd() )
|
||||
{
|
||||
int flags = 0;
|
||||
if (!event.ShiftDown())
|
||||
|
Reference in New Issue
Block a user