Skip to content
Snippets Groups Projects
Commit 3c291085 authored by katahiromz's avatar katahiromz Committed by Alexandre Julliard
Browse files

comctl32/ipaddress: Focus first field on WM_SETFOCUS.

parent 6cfc5df3
Branches
Tags
No related merge requests found
......@@ -632,6 +632,10 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IPM_ISBLANK:
return IPADDRESS_IsBlank (infoPtr);
case WM_SETFOCUS:
IPADDRESS_SetFocusToField (infoPtr, 0);
break;
default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
......
......@@ -113,6 +113,37 @@ static void test_IPM_SETFOCUS(void)
DestroyWindow(hwnd);
}
static void test_WM_SETFOCUS(void)
{
struct child_enum child_enum = {{ 0 }};
unsigned int ret, from, to, i;
HWND hwnd;
hwnd = create_ipaddress_control();
ok(!!hwnd, "Failed to create control.\n");
ret = SendMessageA(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(0, 1, 2, 3));
ok(ret, "Unexpected return value %u.\n", ret);
EnumChildWindows(hwnd, test_child_enum_proc, (LPARAM)&child_enum);
ok(child_enum.count == 4, "Unexpected child count %u.\n", child_enum.count);
SetFocus(child_enum.fields[3]);
for (i = 0; i < 3; ++i)
SendMessageA(child_enum.fields[i], EM_SETSEL, -1, 0);
SendMessageA(child_enum.fields[0], EM_GETSEL, (WPARAM)&from, (LPARAM)&to);
ok(from == 0 && to == 0, "Unexpected selection %u x %u.\n", from, to);
SetFocus(hwnd);
SendMessageA(child_enum.fields[0], EM_GETSEL, (WPARAM)&from, (LPARAM)&to);
ok(from == 0 && to == 1, "Unexpected selection %u x %u.\n", from, to);
DestroyWindow(hwnd);
}
START_TEST(ipaddress)
{
ULONG_PTR cookie;
......@@ -120,12 +151,14 @@ START_TEST(ipaddress)
test_get_set_text();
test_IPM_SETFOCUS();
test_WM_SETFOCUS();
if (!load_v6_module(&cookie, &ctxt))
return;
test_get_set_text();
test_IPM_SETFOCUS();
test_WM_SETFOCUS();
unload_v6_module(cookie, ctxt);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment