Add custom auto-completer support to wxMSW wxComboBox too

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 https://github.com/wxWidgets/wxWidgets/pull/732
This commit is contained in:
AliKet
2018-02-17 14:49:38 +01:00
committed by Vadim Zeitlin
parent 6bb45751e5
commit 4179375f3e

View File

@@ -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 // For all the messages forwarded from the edit control the result is not
// used and 0 must be returned if the message is handled. // used and 0 must be returned if the message is handled.
WXLRESULT result; 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) bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)