Nikolay Sivov : comctl32/listview: Block LVM_EDITLABEL when control is unfocused and no label created.
Alexandre Julliard
julliard at winehq.org
Tue Jun 2 08:44:31 CDT 2009
Module: wine
Branch: master
Commit: 43d982fde6b363199c95037935e0f5446df8f733
URL: http://source.winehq.org/git/wine.git/?a=commit;h=43d982fde6b363199c95037935e0f5446df8f733
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon Jun 1 23:53:48 2009 +0400
comctl32/listview: Block LVM_EDITLABEL when control is unfocused and no label created.
---
dlls/comctl32/listview.c | 2 ++
dlls/comctl32/tests/listview.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index a1aa250..09d8dae 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -5010,6 +5010,8 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
if (~infoPtr->dwStyle & LVS_EDITLABELS) return 0;
if (nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
+ /* Edit could be created only on focused control and if isn't already created */
+ if (GetFocus() != infoPtr->hwndSelf && !IsWindow(infoPtr->hwndEdit)) return 0;
infoPtr->nEditLabelItem = nItem;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index dd5fd86..fa110cd 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2836,7 +2836,7 @@ static void test_getitemrect(void)
static void test_editbox(void)
{
- HWND hwnd, hwndedit;
+ HWND hwnd, hwndedit, hwndedit2;
LVITEMA item;
DWORD r;
static CHAR testitemA[] = "testitem";
@@ -2878,10 +2878,19 @@ static void test_editbox(void)
ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
+ /* send LVM_EDITLABEL on already created edit */
+ SetFocus(hwnd);
+ hwndedit = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0);
+ ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
+ /* focus will be set to edit */
+ ok(GetFocus() == hwndedit, "Expected Edit window to be focused\n");
+ hwndedit2 = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0);
+ ok(IsWindow(hwndedit2), "Expected Edit window to be created\n");
+
/* creating label disabled when control isn't focused */
SetFocus(0);
hwndedit = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0);
- todo_wine ok(hwndedit == NULL, "Expected Edit window not to be created\n");
+ ok(hwndedit == NULL, "Expected Edit window not to be created\n");
DestroyWindow(hwnd);
}
More information about the wine-cvs
mailing list