Fix sending wxEVT_TEXT_ENTER when using auto-completion in wxMSW
We need to explicitly generate this event from the char hook handler as we don't get the normal WM_CHAR for it, it is apparently intercepted by the window proc installed by the auto-completing code, so check if wxTE_PROCESS_ENTER is used for the text entry and call a special new MSWProcessSpecialKey() method to do the right thing if it is. Similarly, handle Tab presses correctly if wxTE_PROCESS_TAB is used. Closes #12613.
This commit is contained in:
@@ -158,6 +158,14 @@ private:
|
||||
virtual wxWindow *GetEditableWindow() wxOVERRIDE;
|
||||
virtual WXHWND GetEditHWND() const wxOVERRIDE;
|
||||
|
||||
// Common part of MSWProcessEditMsg() and MSWProcessSpecialKey(), return
|
||||
// true if the key was processed.
|
||||
bool MSWProcessEditSpecialKey(WXWPARAM vkey);
|
||||
|
||||
#if wxUSE_OLE
|
||||
virtual void MSWProcessSpecialKey(wxKeyEvent& event) wxOVERRIDE;
|
||||
#endif // wxUSE_OLE
|
||||
|
||||
// common part of all ctors
|
||||
void Init()
|
||||
{
|
||||
|
@@ -277,6 +277,10 @@ private:
|
||||
// the simple EDIT controls
|
||||
virtual WXHWND GetEditHWND() const wxOVERRIDE { return m_hWnd; }
|
||||
|
||||
#if wxUSE_OLE
|
||||
virtual void MSWProcessSpecialKey(wxKeyEvent& event) wxOVERRIDE;
|
||||
#endif // wxUSE_OLE
|
||||
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
|
||||
// Used by EN_MAXTEXT handler to increase the size limit (will do nothing
|
||||
|
@@ -86,6 +86,16 @@ private:
|
||||
virtual WXHWND GetEditHWND() const = 0;
|
||||
|
||||
#if wxUSE_OLE
|
||||
// This method is called to process special keys such as Return and Tab
|
||||
// before they're consumed by the auto-completer. Notice that it is only
|
||||
// called if we do need to process the key, i.e. if the corresponding
|
||||
// wxTE_PROCESS_XXX style is set in the associated object.
|
||||
//
|
||||
// It is not pure virtual because it won't get called if the derived class
|
||||
// doesn't use auto-completer, but it does need to be overridden if it can
|
||||
// be called and the default implementation asserts if this is not the case.
|
||||
virtual void MSWProcessSpecialKey(wxKeyEvent& event);
|
||||
|
||||
// Get the auto-complete object creating it if necessary. Returns NULL if
|
||||
// creating it failed.
|
||||
wxTextAutoCompleteData *GetOrCreateCompleter();
|
||||
|
Reference in New Issue
Block a user