CTreeCtrl won't SetCheck when tree isn't visible
Posted on 2004-08-09
I'm using a CTreeCtrl in a expandable dialog(it has a more/less button to show/hide options). The dialog is contracted to start out, which means the Tree is not visible(The visible property is set to true, it is just positioned outside the visible area of the window). When initialize the dialog, i populate the tree. The items get added correctly, and I call SetCheck(item, true) and this returns true, but when I expand the dialog to see the tree, the items are all unchecked.
Also once I have the dialog open, and add items to the tree, they show up as entries but they only show up checked if the tree is visible. Does SetCheck only work if the tree is visible or do I need to do something different.
Here's some code
CTreeCtrl *rl = (CTreeCtrl*)GetDlgItem( IDC_TREE );
p = m_list.FindIndex(i);
rImage img = m_list.GetAt(p);
HTREEITEM item = rl->InsertItem(img.name.c_str());
BOOL res = rl->SetCheck(item, img.checked);