Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
59c398b8
Commit
59c398b8
authored
Dec 02, 2011
by
Alex Henrie
Committed by
Alexandre Julliard
Dec 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: If a dialog has no tab-accessible controls, set focus to first control (with tests).
parent
7f476a23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
dialog.c
dlls/user32/dialog.c
+2
-0
dialog.c
dlls/user32/tests/dialog.c
+26
-2
resource.rc
dlls/user32/tests/resource.rc
+8
-0
No files found.
dlls/user32/dialog.c
View file @
59c398b8
...
@@ -695,6 +695,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
...
@@ -695,6 +695,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if
(
dlgProc
)
if
(
dlgProc
)
{
{
HWND
focus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
HWND
focus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
if
(
!
focus
)
focus
=
GetNextDlgGroupItem
(
hwnd
,
0
,
FALSE
);
if
(
SendMessageW
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
focus
,
param
)
&&
IsWindow
(
hwnd
)
&&
if
(
SendMessageW
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
focus
,
param
)
&&
IsWindow
(
hwnd
)
&&
((
~
template
.
style
&
DS_CONTROL
)
||
(
template
.
style
&
WS_VISIBLE
)))
((
~
template
.
style
&
DS_CONTROL
)
||
(
template
.
style
&
WS_VISIBLE
)))
{
{
...
@@ -702,6 +703,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
...
@@ -702,6 +703,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
* WM_INITDIALOG may have changed the tab order, so find the first
* WM_INITDIALOG may have changed the tab order, so find the first
* tabstop control again. */
* tabstop control again. */
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
if
(
!
dlgInfo
->
hwndFocus
)
dlgInfo
->
hwndFocus
=
GetNextDlgGroupItem
(
hwnd
,
0
,
FALSE
);
if
(
dlgInfo
->
hwndFocus
)
if
(
dlgInfo
->
hwndFocus
)
SetFocus
(
dlgInfo
->
hwndFocus
);
SetFocus
(
dlgInfo
->
hwndFocus
);
}
}
...
...
dlls/user32/tests/dialog.c
View file @
59c398b8
...
@@ -832,8 +832,7 @@ static void test_initial_focus(void)
...
@@ -832,8 +832,7 @@ static void test_initial_focus(void)
{
{
/* Test 1:
/* Test 1:
* This test intentionally returns FALSE in response to WM_INITDIALOG
* This test intentionally returns FALSE in response to WM_INITDIALOG
* without setting focus to a control. This is not allowed according to
* without setting focus to a control. This is what MFC's CFormView does.
* MSDN, but it is exactly what MFC's CFormView does.
*
*
* Since the WM_INITDIALOG handler returns FALSE without setting the focus,
* Since the WM_INITDIALOG handler returns FALSE without setting the focus,
* the focus should initially be NULL. Later, when we manually set focus to
* the focus should initially be NULL. Later, when we manually set focus to
...
@@ -915,6 +914,31 @@ static void test_initial_focus(void)
...
@@ -915,6 +914,31 @@ static void test_initial_focus(void)
DestroyWindow
(
hDlg
);
DestroyWindow
(
hDlg
);
}
}
/* Test 4:
* If the dialog has no tab-accessible controls, set focus to first control */
{
HWND
hDlg
;
HRSRC
hResource
;
HANDLE
hTemplate
;
DLGTEMPLATE
*
pTemplate
;
HWND
hLabel
;
hResource
=
FindResourceA
(
g_hinst
,
"FOCUS_TEST_DIALOG_2"
,
RT_DIALOG
);
hTemplate
=
LoadResource
(
g_hinst
,
hResource
);
pTemplate
=
LockResource
(
hTemplate
);
hDlg
=
CreateDialogIndirectParamA
(
g_hinst
,
pTemplate
,
NULL
,
focusDlgWinProc
,
0
);
g_hwndInitialFocusT1
=
GetFocus
();
hLabel
=
GetDlgItem
(
hDlg
,
200
);
ok
(
hDlg
!=
0
,
"Failed to create test dialog.
\n
"
);
ok
((
g_hwndInitialFocusT1
==
hLabel
),
"Focus should have been set to the first control, expected (%p) got (%p).
\n
"
,
hLabel
,
g_hwndInitialFocusT1
);
DestroyWindow
(
hDlg
);
}
}
}
static
void
test_GetDlgItemText
(
void
)
static
void
test_GetDlgItemText
(
void
)
...
...
dlls/user32/tests/resource.rc
View file @
59c398b8
...
@@ -99,6 +99,14 @@ FONT 8, "MS Shell Dlg"
...
@@ -99,6 +99,14 @@ FONT 8, "MS Shell Dlg"
EDITTEXT 200,4,4,50,14
EDITTEXT 200,4,4,50,14
}
}
FOCUS_TEST_DIALOG_2 DIALOG 0, 0, 60, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Test dialog"
FONT 8, "MS Shell Dlg"
{
LTEXT "Hello world", 200,4,4,50,14
}
IDD_DIALOG DIALOG 0, 0, 186, 95
IDD_DIALOG DIALOG 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
CAPTION "Dialog"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment