Add Escape keypress in functionlist searchbox clears its text

Fix #8667, close #8789
This commit is contained in:
Scott Sumner 2020-09-01 11:11:56 -04:00 committed by Don HO
parent 4ca25503bc
commit 5bcbd9e5ab
1 changed files with 19 additions and 0 deletions

View File

@ -680,6 +680,23 @@ static LRESULT CALLBACK funclstToolbarProc(HWND hwnd, UINT message, WPARAM wPara
return oldFunclstToolbarProc(hwnd, message, wParam, lParam); return oldFunclstToolbarProc(hwnd, message, wParam, lParam);
} }
static WNDPROC oldFunclstSearchEditProc = NULL;
static LRESULT CALLBACK funclstSearchEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
{
if (wParam == VK_ESCAPE)
{
::SendMessage(hwnd, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT("")));
return TRUE;
}
}
}
return oldFunclstSearchEditProc(hwnd, message, wParam, lParam);
}
bool FunctionListPanel::shouldSort() bool FunctionListPanel::shouldSort()
{ {
TBBUTTONINFO tbbuttonInfo; TBBUTTONINFO tbbuttonInfo;
@ -787,6 +804,8 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
2, 2, editWidth, editHeight, 2, 2, editWidth, editHeight,
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 ); _hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
oldFunclstSearchEditProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSearchEdit, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstSearchEditProc)));
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if (hf) if (hf)
::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0)); ::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));