Issue using CTreeCtrl with Checkboxes and SetCheck()
-
Hello there.. I have a CTreeCtrl which has the checkboxes style set. I would like all the checkboxes to be set (ticked) by default. I have function which loops around all the tree items and calls SetCheck() on each tree item. However when calling this function from inside OninitDialog the checkboxes do not get set. If i call this function afer the OninitDialog it works fine. Can anyone help me here.
-
Hello there.. I have a CTreeCtrl which has the checkboxes style set. I would like all the checkboxes to be set (ticked) by default. I have function which loops around all the tree items and calls SetCheck() on each tree item. However when calling this function from inside OninitDialog the checkboxes do not get set. If i call this function afer the OninitDialog it works fine. Can anyone help me here.
ahh-haa... i have found the reason http://groups.google.co.uk/group/microsoft.public.vc.mfc/browse_thread/thread/2ae2e6583698ac21/481e981ec4591749[^] "This is a weird idiosyncracy of the tree control. It's mentioned in the Platform SDK docs under the topic "Tree View Control Window Styles": "If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong after you create the treeview control, and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues. "