[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
This commit is contained in:
Katayama Hirofumi MZ 2020-09-23 08:32:40 +09:00 committed by GitHub
parent 17e094cd34
commit 3f30b1eda7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -453,6 +453,9 @@ static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int
end = -1; end = -1;
SendMessageW(next->EditHwnd, EM_SETSEL, start, end); SendMessageW(next->EditHwnd, EM_SETSEL, start, end);
} }
#ifdef __REACTOS__
SetFocus(next->EditHwnd);
#endif
return TRUE; return TRUE;
} }
@ -563,6 +566,26 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
break; 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; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
@ -573,6 +596,13 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0) if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0)
IPADDRESS_Notify(infoPtr, EN_SETFOCUS); IPADDRESS_Notify(infoPtr, EN_SETFOCUS);
break; 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); 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: case WM_PAINT:
return IPADDRESS_Paint (infoPtr, (HDC)wParam); return IPADDRESS_Paint (infoPtr, (HDC)wParam);
#ifdef __REACTOS__
case WM_SETFOCUS:
IPADDRESS_GotoNextField(infoPtr, -1, POS_SELALL);
return 0;
#endif
case WM_COMMAND: case WM_COMMAND:
switch(wParam >> 16) { switch(wParam >> 16) {
case EN_CHANGE: case EN_CHANGE: