Commit 7b1ff882 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

comctl32: Initialize treeview checkboxes in WM_PAINT when TVS_CHECKBOXES was…

comctl32: Initialize treeview checkboxes in WM_PAINT when TVS_CHECKBOXES was passed during control creation.
parent 40648ddf
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment