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
5bc1a8de
Commit
5bc1a8de
authored
Feb 09, 2007
by
Duane Clark
Committed by
Alexandre Julliard
Feb 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
treeview: Scrolling does not cause label being edited to lose focus.
parent
909425d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
15 deletions
+46
-15
treeview.c
dlls/comctl32/tests/treeview.c
+41
-9
treeview.c
dlls/comctl32/treeview.c
+5
-6
No files found.
dlls/comctl32/tests/treeview.c
View file @
5bc1a8de
...
...
@@ -29,10 +29,10 @@
#include "commctrl.h"
#include "wine/test.h"
static
HWND
hMainWnd
;
static
HWND
hTree
;
static
HWND
hTree
,
hEdit
;
static
HTREEITEM
hRoot
,
hChild
;
static
int
pos
=
0
;
...
...
@@ -140,6 +140,37 @@ static void DoTest2(void)
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(RC)RC45(CR)CR."
),
"root-child select test
\n
"
);
}
static
void
DoFocusTest
(
void
)
{
TVINSERTSTRUCTA
ins
;
static
CHAR
child1
[]
=
"Edit"
,
child2
[]
=
"A really long string"
;
HTREEITEM
hChild1
,
hChild2
;
/* This test verifies that when a label is being edited, scrolling
* the treeview does not cause the label to lose focus. To test
* this, first some additional entries are added to generate
* scrollbars.
*/
ins
.
hParent
=
hRoot
;
ins
.
hInsertAfter
=
hChild
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
child1
;
hChild1
=
TreeView_InsertItem
(
hTree
,
&
ins
);
assert
(
hChild1
);
ins
.
hInsertAfter
=
hChild1
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
child2
;
hChild2
=
TreeView_InsertItem
(
hTree
,
&
ins
);
assert
(
hChild2
);
ShowWindow
(
hMainWnd
,
SW_SHOW
);
SendMessageW
(
hTree
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hChild
);
hEdit
=
TreeView_EditLabel
(
hTree
,
hChild
);
ScrollWindowEx
(
hTree
,
-
10
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
SW_SCROLLCHILDREN
);
ok
(
GetFocus
()
==
hEdit
,
"Edit control should have focus
\n
"
);
}
static
LRESULT
CALLBACK
MyWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
msg
)
{
...
...
@@ -147,9 +178,9 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
case
WM_CREATE
:
{
hTree
=
CreateWindowExA
(
WS_EX_CLIENTEDGE
,
WC_TREEVIEWA
,
NULL
,
WS_CHILD
|
WS_VISIBLE
|
TVS_LINESATROOT
|
TVS_HASLINES
|
TVS_HASBUTTONS
,
0
,
0
,
300
,
5
0
,
hWnd
,
(
HMENU
)
100
,
GetModuleHandleA
(
0
),
0
);
TVS_LINESATROOT
|
TVS_HASLINES
|
TVS_HASBUTTONS
|
TVS_EDITLABELS
,
0
,
0
,
120
,
10
0
,
hWnd
,
(
HMENU
)
100
,
GetModuleHandleA
(
0
),
0
);
SetFocus
(
hTree
);
return
0
;
}
...
...
@@ -211,15 +242,16 @@ START_TEST(treeview)
wc
.
lpszClassName
=
"MyTestWnd"
;
wc
.
lpfnWndProc
=
MyWndProc
;
RegisterClassA
(
&
wc
);
hMainWnd
=
CreateWindowExA
(
0
,
"MyTestWnd"
,
"Blah"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
680
,
260
,
NULL
,
NULL
,
GetModuleHandleA
(
NULL
),
0
);
hMainWnd
=
CreateWindowExA
(
0
,
"MyTestWnd"
,
"Blah"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
130
,
105
,
NULL
,
NULL
,
GetModuleHandleA
(
NULL
),
0
);
GetClientRect
(
hMainWnd
,
&
rc
);
FillRoot
();
DoTest1
();
DoTest2
();
DoFocusTest
();
PostMessageA
(
hMainWnd
,
WM_CLOSE
,
0
,
0
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
...
...
dlls/comctl32/treeview.c
View file @
5bc1a8de
...
...
@@ -4654,9 +4654,6 @@ TREEVIEW_VScroll(TREEVIEW_INFO *infoPtr, WPARAM wParam)
if
(
!
(
infoPtr
->
uInternalStatus
&
TV_VSCROLL
))
return
0
;
if
(
infoPtr
->
hwndEdit
)
SetFocus
(
infoPtr
->
hwnd
);
if
(
!
oldFirstVisible
)
{
assert
(
infoPtr
->
root
->
firstChild
==
NULL
);
...
...
@@ -4727,9 +4724,6 @@ TREEVIEW_HScroll(TREEVIEW_INFO *infoPtr, WPARAM wParam)
if
(
!
(
infoPtr
->
uInternalStatus
&
TV_HSCROLL
))
return
FALSE
;
if
(
infoPtr
->
hwndEdit
)
SetFocus
(
infoPtr
->
hwnd
);
maxWidth
=
infoPtr
->
treeWidth
-
infoPtr
->
clientWidth
;
/* shall never occur */
if
(
maxWidth
<=
0
)
...
...
@@ -5619,6 +5613,11 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
else
return
0
;
case
WM_NCLBUTTONDOWN
:
if
(
infoPtr
->
hwndEdit
)
SetFocus
(
infoPtr
->
hwnd
);
goto
def
;
case
WM_NCPAINT
:
if
(
nc_paint
(
infoPtr
,
(
HRGN
)
wParam
))
return
0
;
...
...
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