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
34d86a2d
Commit
34d86a2d
authored
May 08, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 09, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listview: Make edit box handle available from LVN_ENDLABELEDIT notification.
parent
5f12a642
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
16 deletions
+52
-16
listview.c
dlls/comctl32/listview.c
+13
-14
listview.c
dlls/comctl32/tests/listview.c
+39
-2
No files found.
dlls/comctl32/listview.c
View file @
34d86a2d
...
@@ -5662,7 +5662,7 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
...
@@ -5662,7 +5662,7 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
WCHAR
szDispText
[
DISP_TEXT_SIZE
]
=
{
0
};
WCHAR
szDispText
[
DISP_TEXT_SIZE
]
=
{
0
};
NMLVDISPINFOW
dispInfo
;
NMLVDISPINFOW
dispInfo
;
INT
editedItem
=
infoPtr
->
nEditLabelItem
;
INT
editedItem
=
infoPtr
->
nEditLabelItem
;
BOOL
bS
ame
;
BOOL
s
ame
;
WCHAR
*
pszText
=
NULL
;
WCHAR
*
pszText
=
NULL
;
BOOL
res
;
BOOL
res
;
...
@@ -5682,9 +5682,6 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
...
@@ -5682,9 +5682,6 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
TRACE
(
"(pszText=%s, isW=%d)
\n
"
,
debugtext_t
(
pszText
,
isW
),
isW
);
TRACE
(
"(pszText=%s, isW=%d)
\n
"
,
debugtext_t
(
pszText
,
isW
),
isW
);
infoPtr
->
nEditLabelItem
=
-
1
;
infoPtr
->
hwndEdit
=
0
;
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
dispInfo
.
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
|
LVIF_TEXT
;
dispInfo
.
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
|
LVIF_TEXT
;
dispInfo
.
item
.
iItem
=
editedItem
;
dispInfo
.
item
.
iItem
=
editedItem
;
...
@@ -5699,32 +5696,34 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
...
@@ -5699,32 +5696,34 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
}
}
if
(
isW
)
if
(
isW
)
bS
ame
=
(
lstrcmpW
(
dispInfo
.
item
.
pszText
,
pszText
)
==
0
);
s
ame
=
(
lstrcmpW
(
dispInfo
.
item
.
pszText
,
pszText
)
==
0
);
else
else
{
{
LPWSTR
tmp
=
textdupTtoW
(
pszText
,
FALSE
);
LPWSTR
tmp
=
textdupTtoW
(
pszText
,
FALSE
);
bS
ame
=
(
lstrcmpW
(
dispInfo
.
item
.
pszText
,
tmp
)
==
0
);
s
ame
=
(
lstrcmpW
(
dispInfo
.
item
.
pszText
,
tmp
)
==
0
);
textfreeT
(
tmp
,
FALSE
);
textfreeT
(
tmp
,
FALSE
);
}
}
/* add the text from the edit in */
/* add the text from the edit in */
dispInfo
.
item
.
mask
|=
LVIF_TEXT
;
dispInfo
.
item
.
mask
|=
LVIF_TEXT
;
dispInfo
.
item
.
pszText
=
bS
ame
?
NULL
:
pszText
;
dispInfo
.
item
.
pszText
=
s
ame
?
NULL
:
pszText
;
dispInfo
.
item
.
cchTextMax
=
bSame
?
0
:
textlenT
(
pszText
,
isW
);
dispInfo
.
item
.
cchTextMax
=
textlenT
(
dispInfo
.
item
.
pszText
,
isW
);
/* Do we need to update the Item Text */
/* Do we need to update the Item Text */
if
(
!
notify_dispinfoT
(
infoPtr
,
LVN_ENDLABELEDITW
,
&
dispInfo
,
isW
))
res
=
notify_dispinfoT
(
infoPtr
,
LVN_ENDLABELEDITW
,
&
dispInfo
,
isW
);
{
res
=
FALSE
;
infoPtr
->
nEditLabelItem
=
-
1
;
goto
cleanup
;
infoPtr
->
hwndEdit
=
0
;
}
if
(
!
res
)
goto
cleanup
;
if
(
!
IsWindow
(
hwndSelf
))
if
(
!
IsWindow
(
hwndSelf
))
{
{
res
=
FALSE
;
res
=
FALSE
;
goto
cleanup
;
goto
cleanup
;
}
}
if
(
!
pszText
)
return
TRUE
;
if
(
!
pszText
)
return
TRUE
;
if
(
bS
ame
)
if
(
s
ame
)
{
{
res
=
TRUE
;
res
=
TRUE
;
goto
cleanup
;
goto
cleanup
;
...
...
dlls/comctl32/tests/listview.c
View file @
34d86a2d
...
@@ -61,6 +61,8 @@ static BOOL g_is_below_5;
...
@@ -61,6 +61,8 @@ static BOOL g_is_below_5;
static
LVITEMA
g_itema
;
static
LVITEMA
g_itema
;
/* alter notification code A->W */
/* alter notification code A->W */
static
BOOL
g_disp_A_to_W
;
static
BOOL
g_disp_A_to_W
;
/* dispinfo data sent with LVN_LVN_ENDLABELEDIT */
static
NMLVDISPINFO
g_editbox_disp_info
;
static
HWND
subclass_editbox
(
HWND
hwndListview
);
static
HWND
subclass_editbox
(
HWND
hwndListview
);
...
@@ -358,9 +360,17 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
...
@@ -358,9 +360,17 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
}
}
case
LVN_ENDLABELEDIT
:
case
LVN_ENDLABELEDIT
:
{
{
HWND
edit
;
/* always accept new item text */
/* always accept new item text */
NMLVDISPINFO
*
di
=
(
NMLVDISPINFO
*
)
lParam
;
NMLVDISPINFO
*
di
=
(
NMLVDISPINFO
*
)
lParam
;
g_editbox_disp_info
=
*
di
;
trace
(
"LVN_ENDLABELEDIT: text=%s
\n
"
,
di
->
item
.
pszText
);
trace
(
"LVN_ENDLABELEDIT: text=%s
\n
"
,
di
->
item
.
pszText
);
/* edit control still available from this notification */
edit
=
(
HWND
)
SendMessageA
(((
NMHDR
*
)
lParam
)
->
hwndFrom
,
LVM_GETEDITCONTROL
,
0
,
0
);
ok
(
IsWindow
(
edit
),
"expected valid edit control handle
\n
"
);
return
TRUE
;
return
TRUE
;
}
}
case
LVN_BEGINSCROLL
:
case
LVN_BEGINSCROLL
:
...
@@ -3611,6 +3621,7 @@ static void test_editbox(void)
...
@@ -3611,6 +3621,7 @@ static void test_editbox(void)
{
{
static
CHAR
testitemA
[]
=
"testitem"
;
static
CHAR
testitemA
[]
=
"testitem"
;
static
CHAR
testitem1A
[]
=
"testitem_quitelongname"
;
static
CHAR
testitem1A
[]
=
"testitem_quitelongname"
;
static
CHAR
testitem2A
[]
=
"testITEM_quitelongname"
;
static
CHAR
buffer
[
25
];
static
CHAR
buffer
[
25
];
HWND
hwnd
,
hwndedit
,
hwndedit2
,
header
;
HWND
hwnd
,
hwndedit
,
hwndedit2
,
header
;
LVITEMA
item
;
LVITEMA
item
;
...
@@ -3707,8 +3718,11 @@ static void test_editbox(void)
...
@@ -3707,8 +3718,11 @@ static void test_editbox(void)
/* modify edit and notify control that it lost focus */
/* modify edit and notify control that it lost focus */
r
=
SendMessage
(
hwndedit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
testitem1A
);
r
=
SendMessage
(
hwndedit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
testitem1A
);
expect
(
TRUE
,
r
);
expect
(
TRUE
,
r
);
g_editbox_disp_info
.
item
.
pszText
=
NULL
;
r
=
SendMessage
(
hwnd
,
WM_COMMAND
,
MAKEWPARAM
(
0
,
EN_KILLFOCUS
),
(
LPARAM
)
hwndedit
);
r
=
SendMessage
(
hwnd
,
WM_COMMAND
,
MAKEWPARAM
(
0
,
EN_KILLFOCUS
),
(
LPARAM
)
hwndedit
);
expect
(
0
,
r
);
expect
(
0
,
r
);
ok
(
g_editbox_disp_info
.
item
.
pszText
!=
NULL
,
"expected notification with not null text
\n
"
);
memset
(
&
item
,
0
,
sizeof
(
item
));
memset
(
&
item
,
0
,
sizeof
(
item
));
item
.
pszText
=
buffer
;
item
.
pszText
=
buffer
;
item
.
cchTextMax
=
sizeof
(
buffer
);
item
.
cchTextMax
=
sizeof
(
buffer
);
...
@@ -3718,6 +3732,29 @@ static void test_editbox(void)
...
@@ -3718,6 +3732,29 @@ static void test_editbox(void)
expect
(
lstrlen
(
item
.
pszText
),
r
);
expect
(
lstrlen
(
item
.
pszText
),
r
);
ok
(
strcmp
(
buffer
,
testitem1A
)
==
0
,
"Expected item text to change
\n
"
);
ok
(
strcmp
(
buffer
,
testitem1A
)
==
0
,
"Expected item text to change
\n
"
);
ok
(
!
IsWindow
(
hwndedit
),
"Expected Edit window to be freed
\n
"
);
ok
(
!
IsWindow
(
hwndedit
),
"Expected Edit window to be freed
\n
"
);
/* change item name to differ in casing only */
SetFocus
(
hwnd
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
ok
(
IsWindow
(
hwndedit
),
"Expected Edit window to be created
\n
"
);
/* modify edit and notify control that it lost focus */
r
=
SendMessage
(
hwndedit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
testitem2A
);
expect
(
TRUE
,
r
);
g_editbox_disp_info
.
item
.
pszText
=
NULL
;
r
=
SendMessage
(
hwnd
,
WM_COMMAND
,
MAKEWPARAM
(
0
,
EN_KILLFOCUS
),
(
LPARAM
)
hwndedit
);
expect
(
0
,
r
);
ok
(
g_editbox_disp_info
.
item
.
pszText
!=
NULL
,
"got %p
\n
"
,
g_editbox_disp_info
.
item
.
pszText
);
memset
(
&
item
,
0
,
sizeof
(
item
));
item
.
pszText
=
buffer
;
item
.
cchTextMax
=
sizeof
(
buffer
);
item
.
iItem
=
0
;
item
.
iSubItem
=
0
;
r
=
SendMessage
(
hwnd
,
LVM_GETITEMTEXTA
,
0
,
(
LPARAM
)
&
item
);
expect
(
lstrlen
(
item
.
pszText
),
r
);
ok
(
strcmp
(
buffer
,
testitem2A
)
==
0
,
"got %s, expected %s
\n
"
,
buffer
,
testitem2A
);
ok
(
!
IsWindow
(
hwndedit
),
"Expected Edit window to be freed
\n
"
);
/* end edit without saving */
/* end edit without saving */
SetFocus
(
hwnd
);
SetFocus
(
hwnd
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
...
@@ -3742,7 +3779,7 @@ static void test_editbox(void)
...
@@ -3742,7 +3779,7 @@ static void test_editbox(void)
item
.
iSubItem
=
0
;
item
.
iSubItem
=
0
;
r
=
SendMessage
(
hwnd
,
LVM_GETITEMTEXTA
,
0
,
(
LPARAM
)
&
item
);
r
=
SendMessage
(
hwnd
,
LVM_GETITEMTEXTA
,
0
,
(
LPARAM
)
&
item
);
expect
(
lstrlen
(
item
.
pszText
),
r
);
expect
(
lstrlen
(
item
.
pszText
),
r
);
ok
(
strcmp
(
buffer
,
testitem
1
A
)
==
0
,
"Expected item text to change
\n
"
);
ok
(
strcmp
(
buffer
,
testitem
2
A
)
==
0
,
"Expected item text to change
\n
"
);
/* LVM_EDITLABEL with -1 destroys current edit */
/* LVM_EDITLABEL with -1 destroys current edit */
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_GETEDITCONTROL
,
0
,
0
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_GETEDITCONTROL
,
0
,
0
);
...
@@ -3786,7 +3823,7 @@ static void test_editbox(void)
...
@@ -3786,7 +3823,7 @@ static void test_editbox(void)
ok_sequence
(
sequences
,
EDITBOX_SEQ_INDEX
,
editbox_create_pos
,
ok_sequence
(
sequences
,
EDITBOX_SEQ_INDEX
,
editbox_create_pos
,
"edit box create - sizing"
,
FALSE
);
"edit box create - sizing"
,
FALSE
);
/* WM_COMMAND with EN_KILLFOCUS isn't forwared to parent */
/* WM_COMMAND with EN_KILLFOCUS isn't forwar
d
ed to parent */
SetFocus
(
hwnd
);
SetFocus
(
hwnd
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
ok
(
IsWindow
(
hwndedit
),
"Expected Edit window to be created
\n
"
);
ok
(
IsWindow
(
hwndedit
),
"Expected Edit window to be created
\n
"
);
...
...
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