Skip to content

Commit

Permalink
Add custom auto-completer support to wxMSW wxComboBox too
Browse files Browse the repository at this point in the history
Custom auto-completers didn't work for wxComboBox as it didn't generate
wxEVT_AFTER_CHAR event that the completion code in wxTextEntry relies on
to make them work.

Add this event generation to wxComboBox::MSWProcessEditMsg() to fix
this.

Closes wxWidgets#732
  • Loading branch information
AliKet authored and vadz committed Feb 17, 2018
1 parent 6bb4575 commit 4179375
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/msw/combobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,25 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
// For all the messages forwarded from the edit control the result is not
// used and 0 must be returned if the message is handled.
WXLRESULT result;
return MSWHandleMessage(&result, msg, wParam, lParam);
bool processed = MSWHandleMessage(&result, msg, wParam, lParam);

// Special hack for WM_CHAR needed by wxTextEntry auto-completion support.
if ( !processed && msg == WM_CHAR )
{
// Here we reproduce what MSWDefWindowProc() does for this window
// itself, but for the EDIT window.
::CallWindowProc(CASTWNDPROC gs_wndprocEdit, (HWND)GetEditHWND(),
msg, wParam, lParam);

// Send the event allowing completion code to do its thing.
wxKeyEvent event(CreateCharEvent(wxEVT_AFTER_CHAR, wParam, lParam));
HandleWindowEvent(event);

// Default window proc was already called, don't call it again.
processed = true;
}

return processed;
}

bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
Expand Down

0 comments on commit 4179375

Please sign in to comment.