From 3f30b1eda7e51dae1df0b411e75b99a03e9fbca2 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Wed, 23 Sep 2020 08:32:40 +0900 Subject: [PATCH] [COMCTL32] Improve IP Address Controls (Tab and caret) (#3212) Improve IP address controls. - Set focus to EDIT control to show caret. - Process WM_GETDLGCODE messages on EDIT control to catch Tab key. - Process Tab key and Shift+Tab key in processing WM_KEYDOWN. CORE-3479 --- dll/win32/comctl32/ipaddress.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dll/win32/comctl32/ipaddress.c b/dll/win32/comctl32/ipaddress.c index 6e7b703bb499e..9f1b2c08c387c 100644 --- a/dll/win32/comctl32/ipaddress.c +++ b/dll/win32/comctl32/ipaddress.c @@ -453,6 +453,9 @@ static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int end = -1; SendMessageW(next->EditHwnd, EM_SETSEL, start, end); } +#ifdef __REACTOS__ + SetFocus(next->EditHwnd); +#endif return TRUE; } @@ -563,6 +566,26 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } break; +#ifdef __REACTOS__ + case VK_TAB: + if (GetKeyState(VK_SHIFT) < 0) + { + /* Shift+Tab */ + if (index == 0) + SetFocus(GetNextDlgTabItem(GetParent(infoPtr->Self), infoPtr->Self, TRUE)); + else + IPADDRESS_GotoNextField(infoPtr, index - 2, POS_SELALL); + } + else + { + /* Tab */ + if (index == 3) + SetFocus(GetNextDlgTabItem(GetParent(infoPtr->Self), infoPtr->Self, FALSE)); + else + IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); + } + break; +#endif } break; case WM_KILLFOCUS: @@ -573,6 +596,13 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0) IPADDRESS_Notify(infoPtr, EN_SETFOCUS); break; +#ifdef __REACTOS__ + case WM_GETDLGCODE: + { + LRESULT ret = DefWindowProcW(hwnd, uMsg, wParam, lParam); + return ret | DLGC_WANTTAB; + } +#endif } return CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam); } @@ -602,6 +632,11 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_PAINT: return IPADDRESS_Paint (infoPtr, (HDC)wParam); +#ifdef __REACTOS__ + case WM_SETFOCUS: + IPADDRESS_GotoNextField(infoPtr, -1, POS_SELALL); + return 0; +#endif case WM_COMMAND: switch(wParam >> 16) { case EN_CHANGE: