comctl32: Initialize treeview checkboxes in WM_PAINT when TVS_CHECKBOXES was passed during control creation.

This commit is contained in:
Piotr Caban 2013-10-31 17:27:51 +01:00 committed by Alexandre Julliard
parent 40648ddfd5
commit 7b1ff882d1
2 changed files with 35 additions and 4 deletions

View File

@ -1771,6 +1771,7 @@ static void test_TVS_CHECKBOXES(void)
HWND hTree, hTree2;
TVITEMA item;
DWORD ret;
MSG msg;
hTree = create_treeview_control(0);
fill_tree(hTree);
@ -1850,7 +1851,7 @@ static void test_TVS_CHECKBOXES(void)
hTree = create_treeview_control(TVS_CHECKBOXES);
fill_tree(hTree);
himl = (HIMAGELIST)SendMessageA(hTree, TVM_GETIMAGELIST, TVSIL_STATE, 0);
todo_wine ok(himl == NULL, "got %p\n", himl);
ok(himl == NULL, "got %p\n", himl);
item.hItem = hRoot;
item.mask = TVIF_STATE;
@ -1868,6 +1869,39 @@ static void test_TVS_CHECKBOXES(void)
expect(TRUE, ret);
ok(item.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", item.state);
item.hItem = hChild;
item.mask = TVIF_STATE;
item.state = INDEXTOSTATEIMAGEMASK(2);
item.stateMask = TVIS_STATEIMAGEMASK;
ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
expect(TRUE, ret);
item.hItem = hChild;
item.mask = TVIF_STATE;
item.state = 0;
ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, ret);
ok(item.state == INDEXTOSTATEIMAGEMASK(2), "got 0x%x\n", item.state);
while(GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
if((msg.hwnd == hTree) && (msg.message == WM_PAINT))
break;
}
item.hItem = hChild;
item.mask = TVIF_STATE;
item.state = 0;
ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, ret);
ok(item.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", item.state);
himl = (HIMAGELIST)SendMessageA(hTree, TVM_GETIMAGELIST, TVSIL_STATE, 0);
ok(himl != NULL, "got %p\n", himl);
DestroyWindow(hTree);
}

View File

@ -5137,9 +5137,6 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, 0, 0, 0);
if (infoPtr->dwStyle & TVS_CHECKBOXES)
TREEVIEW_InitCheckboxes(infoPtr);
/* Make sure actual scrollbar state is consistent with uInternalStatus */
ShowScrollBar(hwnd, SB_VERT, FALSE);
ShowScrollBar(hwnd, SB_HORZ, FALSE);