Fix handling keys also used as accelerators in wxMSW wxComboBox

wxComboBox::MSWShouldPreProcessMessage() didn't take into account many
keys that must be handled in wxComboBox even if they're used as
accelerators, including plain (i.e. without Ctrl modifier) Delete, Home
and End that are used by the embedded text control, if there is one.

Fix this by reusing wxTextCtrl::MSWShouldPreProcessMessage() which
already handled these keys correctly, by moving it to wxTextEntry, which
can be used from both classes.

Also add a check for wxCB_READONLY to prevent overriding the
accelerators using the keys that the combobox doesn't need when there is
no text control in it.

Closes #19227.
This commit is contained in:
Vadim Zeitlin
2021-07-23 16:59:08 +01:00
parent af019685da
commit 8004002e5e
4 changed files with 94 additions and 88 deletions

View File

@@ -84,6 +84,10 @@ protected:
// Returns true if this control uses standard file names completion.
bool MSWUsesStandardAutoComplete() const;
// Returns false if this message shouldn't be preprocessed, but is always
// handled by the EDIT control represented by this object itself.
bool MSWShouldPreProcessMessage(WXMSG* msg) const;
// Helper for wxTE_PROCESS_ENTER handling: activates the default button in
// the dialog containing this control if any.
bool ClickDefaultButtonIfPossible();