📄 dialog.c
字号:
* 18. As 16 except note that the next group is started with an invisible
* enabled control.
* 19. Next Group wraps around the controls of the dialog
* 20. Next Group is the same even if the initial control is disabled.
* 21. Next Group is the same even if the initial control is invisible.
* 22. Next Group is the same even if the initial control has the group style
* 23. Next Group returns the initial control if there is no visible enabled
* control in the group. (Initial control disabled and not group style).
* 24. Prev version of test 16.
* Prev Group of a visible enabled non-group control wraps around to the
* beginning of the group on finding a control that starts the group.
* Note that the group is in the middle of the dialog.
*
* In tests 25 to 28 the control is sitting under dialogs which do not have
* the WS_EX_CONTROLPARENT style and so cannot be reached from the top of
* the dialog.
*
* 25. Next Group of an inaccessible control is as if it were accessible
* 26. Prev Group of an inaccessible control begins searching at the highest
* level ancestor that did not permit recursion down the hierarchy
* 27. Next Tab of an inaccessible control is as if it were accessible
* 28. Prev Tab of an inaccessible control begins searching at the highest
* level ancestor that did not permit recursion down the hierarchy.
*
* Tests 29- are the basic Tab tests
*
* 29. Next Tab of a control is the next visible enabled control with the
* Tabstop style (N.B. skips disabled, invisible and non-tabstop)
* 30. Prev Tab of a control is the previous visible enabled control with the
* Tabstop style (N.B. skips disabled, invisible and non-tabstop)
* 31. Next Tab test with at least two layers of descent and finding the
* result not at the first control.
* 32. Next Tab test with at least two layers of descent with the descent and
* control at the start of each level.
* 33. Prev Tab test with at least two layers of descent and finding the
* result not at the last control.
* 34. Prev Tab test with at least two layers of descent with the descent and
* control at the end of each level.
*
* 35. Passing NULL may result in the first child being the one returned.
* (group test)
* 36. Passing NULL may result in the first child being the one returned.
* (tab test)
*/
static void GetNextDlgItemTest (void)
{
static test_record test [] =
{
/* isok test dlg ctl tab prev res */
{ 1, 1, 6, 0, 0, 1, 0},
{ 1, 2, 6, 0, 1, 1, 0},
{ 1, 3, 6, 6, 0, 1, 0},
{ 1, 4, 6, 6, 1, 1, 0},
{ 1, 5, 6, 0, 0, 0, 66},
{ 1, 6, 6, 0, 1, 0, 67},
{ 1, 7, 6, 6, 0, 0, 66},
{ 1, 8, 6, 6, 1, 0, 67},
{ 1, 9, 4, 83, 1, 0, 84},
{ 1, 10, 4, 83, 0, 0, 5},
{ 1, 11, 5, 81, 1, 0, 67},
{ 1, 12, 5, 81, 0, 0, 66},
{ 1, 13, 5, 82, 1, 1, 78},
{ 1, 14, 5, 82, 0, 1, 79},
{ 1, 15, 6, 70, 0, 0, 72},
{ 1, 16, 6, 72, 0, 0, 25},
{ 1, 17, 6, 75, 0, 0, 26},
{ 1, 18, 6, 77, 0, 0, 76},
{ 1, 19, 6, 79, 0, 0, 66},
{ 1, 20, 6, 71, 0, 0, 72},
{ 1, 21, 6, 64, 0, 0, 66},
{ 1, 22, 6, 25, 0, 0, 70},
{ 1, 23, 6, 68, 0, 0, 68},
{ 1, 24, 6, 25, 0, 1, 72},
{ 1, 25, 1, 70, 0, 0, 72},
/*{ 0, 26, 1, 70, 0, 1, 3}, Crashes Win95*/
{ 1, 27, 1, 70, 1, 0, 72},
/*{ 0, 28, 1, 70, 1, 1, 61}, Crashes Win95*/
{ 1, 29, 6, 67, 1, 0, 72},
{ 1, 30, 6, 72, 1, 1, 67},
{ 1, 35, 2, 0, 0, 0, 60},
{ 1, 36, 2, 0, 1, 0, 60},
{ 0, 0, 0, 0, 0, 0, 0} /* End of test */
};
const test_record *p = test;
ok (CreateWindows (g_hinst), "Could not create test windows\n");
while (p->dlg)
{
HWND a;
a = (p->tab ? GetNextDlgTabItem : GetNextDlgGroupItem) (hwnd[p->dlg], hwnd[p->ctl], p->prev);
if (p->isok)
{
ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was %d instead of %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res);
}
else
{
todo_wine
{
ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was actually %d matching expected %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res);
}
}
p++;
}
}
/*
* OnMainWindowCreate
*/
static BOOL OnMainWindowCreate (HWND hwnd, LPCREATESTRUCT lpcs)
{
g_hwndButton1 = CreateWindow (TEXT("button"), TEXT("Button &1"),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON | BS_TEXT,
10, 10, 80, 80, hwnd, (HMENU)100, g_hinst, 0);
if (!g_hwndButton1) return FALSE;
g_hwndButton2 = CreateWindow (TEXT("button"), TEXT("Button &2"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_TEXT,
110, 10, 80, 80, hwnd, (HMENU)200, g_hinst, 0);
if (!g_hwndButton2) return FALSE;
g_hwndButtonCancel = CreateWindow (TEXT("button"), TEXT("Cancel"),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_TEXT,
210, 10, 80, 80, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
if (!g_hwndButtonCancel) return FALSE;
return TRUE;
}
/*
* OnTestDlgCreate
*/
static BOOL OnTestDlgCreate (HWND hwnd, LPCREATESTRUCT lpcs)
{
g_hwndTestDlgEdit = CreateWindowEx ( WS_EX_LEFT | WS_EX_LTRREADING |
WS_EX_RIGHTSCROLLBAR | WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE,
TEXT("Edit"), TEXT("Edit"),
WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL,
16,33,184,24, hwnd, (HMENU)101, g_hinst, 0);
if (!g_hwndTestDlgEdit) return FALSE;
g_hwndTestDlgBut1 = CreateWindowEx ( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR
| WS_EX_NOPARENTNOTIFY,
TEXT("button"), TEXT("Button &1"),
WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_TEXT,
204,33,30,24, hwnd, (HMENU)201, g_hinst, 0);
if (!g_hwndTestDlgBut1) return FALSE;
g_hwndTestDlgBut2 = CreateWindowEx ( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR
| WS_EX_NOPARENTNOTIFY, TEXT("button"),
TEXT("Button &2"),
WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_TEXT,
90,102,80,24, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
if (!g_hwndTestDlgBut2) return FALSE;
return TRUE;
}
static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
LPARAM lParam)
{
LRESULT result;
switch (uiMsg)
{
/* Add blank case statements for these to ensure we don't use them
* by mistake.
*/
case DM_GETDEFID: break;
case DM_SETDEFID: break;
case WM_CREATE:
return (OnMainWindowCreate (hwnd,
(LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
case WM_COMMAND:
if (wParam == IDCANCEL)
{
g_terminated = TRUE;
return 0;
}
break;
}
result=DefWindowProcA (hwnd, uiMsg, wParam, lParam);
return result;
}
static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam,
LPARAM lParam)
{
LRESULT result;
switch (uiMsg)
{
/* Add blank case statements for these to ensure we don't use them
* by mistake.
*/
case DM_GETDEFID: break;
case DM_SETDEFID: break;
case WM_CREATE:
return (OnTestDlgCreate (hwnd,
(LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
}
result=DefWindowProcA (hwnd, uiMsg, wParam, lParam);
return result;
}
static BOOL RegisterWindowClasses (void)
{
WNDCLASSA cls;
cls.style = 0;
cls.lpfnWndProc = DefWindowProcA;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = g_hinst;
cls.hIcon = NULL;
cls.hCursor = LoadCursorA (NULL, IDC_ARROW);
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
cls.lpszMenuName = NULL;
cls.lpszClassName = "GetNextDlgItemWindowClass";
if (!RegisterClassA (&cls)) return FALSE;
cls.lpfnWndProc = main_window_procA;
cls.lpszClassName = "IsDialogMessageWindowClass";
if (!RegisterClassA (&cls)) return FALSE;
GetClassInfoA(0, "#32770", &cls);
cls.lpfnWndProc = testDlgWinProc;
cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
if (!RegisterClassA (&cls)) return FALSE;
return TRUE;
}
static void WM_NEXTDLGCTLTest(void)
{
DWORD dwVal;
g_hwndTestDlg = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR
| WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT | WS_EX_APPWINDOW,
"WM_NEXTDLGCTLWndClass",
"WM_NEXTDLGCTL Message test window",
WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_DLGFRAME | WS_OVERLAPPED |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | DS_3DLOOK | DS_SETFONT | DS_MODALFRAME,
0, 0, 235, 135,
NULL, NULL, g_hinst, 0);
assert (g_hwndTestDlg);
assert (g_hwndTestDlgBut1);
assert (g_hwndTestDlgBut2);
assert (g_hwndTestDlgEdit);
/*
* Test message DM_SETDEFID
*/
DefDlgProcA( g_hwndTestDlg, DM_SETDEFID, IDCANCEL, 0 );
DefDlgProcA( g_hwndTestDlgBut1, BM_SETSTYLE, BS_DEFPUSHBUTTON, FALSE );
dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
ok ( IDCANCEL == (LOWORD(dwVal)), "Did not set default ID\n" );
/*
* Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
* the destination control is a button, style of the button should be changed to
* BS_DEFPUSHBUTTON with out making it default.
*/
/*
* Keep the focus on Edit control.
*/
if ( SetFocus( g_hwndTestDlgEdit ) )
{
ok ((GetFocus() == g_hwndTestDlgEdit), "Focus didn't set on Edit control\n");
/*
* Test message WM_NEXTDLGCTL
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -