Fix handling of Esc while an auto-complete drop down is open in wxMSW.
Just close the drop down instead of closing the dialog the text control using this auto-complete drop down is in, as this was completely unexpected and counter-intuitive. Closes #13945. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -621,6 +621,7 @@ wxMSW:
|
|||||||
- Fix handling of unsupported formats in dnd (jwiesemann).
|
- Fix handling of unsupported formats in dnd (jwiesemann).
|
||||||
- Fix blank wxBitmapComboBox dropdown appearance.
|
- Fix blank wxBitmapComboBox dropdown appearance.
|
||||||
- Fix clicking on checkboxes in wxDataViewCtrl.
|
- Fix clicking on checkboxes in wxDataViewCtrl.
|
||||||
|
- Fix handling of Esc while an auto-complete drop down is open (Chaobin Zhang).
|
||||||
- Many improvements to alpha transparency handling (Artur Wieczorek).
|
- Many improvements to alpha transparency handling (Artur Wieczorek).
|
||||||
- Make "%lu" work with size_t arguments under Win64 (laro).
|
- Make "%lu" work with size_t arguments under Win64 (laro).
|
||||||
- Fix wxRegion::Offset() with shared objects (Joost Nieuwenhuijse).
|
- Fix wxRegion::Offset() with shared objects (Joost Nieuwenhuijse).
|
||||||
|
@@ -102,6 +102,10 @@ DEFINE_GUID(wxIID_IAutoCompleteDropDown,
|
|||||||
DEFINE_GUID(wxCLSID_AutoComplete,
|
DEFINE_GUID(wxCLSID_AutoComplete,
|
||||||
0x00bb2763, 0x6a77, 0x11d0, 0xa5, 0x35, 0x00, 0xc0, 0x4f, 0xd7, 0xd0, 0x62);
|
0x00bb2763, 0x6a77, 0x11d0, 0xa5, 0x35, 0x00, 0xc0, 0x4f, 0xd7, 0xd0, 0x62);
|
||||||
|
|
||||||
|
#ifndef ACDD_VISIBLE
|
||||||
|
#define ACDD_VISIBLE 0x0001
|
||||||
|
#endif
|
||||||
|
|
||||||
// Small helper class which can be used to ensure thread safety even when
|
// Small helper class which can be used to ensure thread safety even when
|
||||||
// wxUSE_THREADS==0 (and hence wxCriticalSection does nothing).
|
// wxUSE_THREADS==0 (and hence wxCriticalSection does nothing).
|
||||||
class CSLock
|
class CSLock
|
||||||
@@ -433,6 +437,10 @@ public:
|
|||||||
ACO_UPDOWNKEYDROPSLIST);
|
ACO_UPDOWNKEYDROPSLIST);
|
||||||
pAutoComplete2->Release();
|
pAutoComplete2->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBIND_OR_CONNECT_HACK(m_win, wxEVT_CHAR_HOOK, wxKeyEventHandler,
|
||||||
|
wxTextAutoCompleteData::OnCharHook,
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxTextAutoCompleteData()
|
~wxTextAutoCompleteData()
|
||||||
@@ -568,6 +576,28 @@ private:
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnCharHook(wxKeyEvent& event)
|
||||||
|
{
|
||||||
|
// If the autocomplete drop-down list is currently displayed when the
|
||||||
|
// user presses Escape, we need to dismiss it manually from here as
|
||||||
|
// Escape could be eaten by something else (e.g. EVT_CHAR_HOOK in the
|
||||||
|
// dialog that this control is found in) otherwise.
|
||||||
|
if ( event.GetKeyCode() == WXK_ESCAPE )
|
||||||
|
{
|
||||||
|
DWORD dwFlags = 0;
|
||||||
|
if ( SUCCEEDED(m_autoCompleteDropDown->GetDropDownStatus(&dwFlags,
|
||||||
|
NULL))
|
||||||
|
&& dwFlags == ACDD_VISIBLE )
|
||||||
|
{
|
||||||
|
::SendMessage(GetHwndOf(m_win), WM_KEYDOWN, WXK_ESCAPE, 0);
|
||||||
|
|
||||||
|
// Do not skip the event in this case, we've already handled it.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// The text entry we're associated with.
|
// The text entry we're associated with.
|
||||||
wxTextEntry * const m_entry;
|
wxTextEntry * const m_entry;
|
||||||
|
Reference in New Issue
Block a user