PRMARJORAM
2008-05-14 15:01:02 UTC
Im using a MFC CTreeView which fits nicely with what im trying to do. I need
to change the style of the nested CTreeCtrl.
There is no easy way to do this, the documentation points to using
SetWindowLong.
void CMyTreeView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
CTreeCtrl& tree = GetTreeCtrl();
HTREEITEM root_item = tree.InsertItem(CString("MyProject"));
HTREEITEM init_request = tree.InsertItem(CString("Item 1"), root_item);
HTREEITEM doc_package = tree.InsertItem(CString("Item 2"), root_item);
ASSERT(tree.GetSafeHwnd() != NULL );
::SetWindowLong(tree.GetSafeHwnd(),GWL_STYLE,TVS_HASLINES |TVS_LINESATROOT);
}
Iv tried using this to set the styles as in the above code, but the program
gets corrupted.
How can i set the style of a CTreeCtrl nested in a CTreeView?
to change the style of the nested CTreeCtrl.
There is no easy way to do this, the documentation points to using
SetWindowLong.
void CMyTreeView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
CTreeCtrl& tree = GetTreeCtrl();
HTREEITEM root_item = tree.InsertItem(CString("MyProject"));
HTREEITEM init_request = tree.InsertItem(CString("Item 1"), root_item);
HTREEITEM doc_package = tree.InsertItem(CString("Item 2"), root_item);
ASSERT(tree.GetSafeHwnd() != NULL );
::SetWindowLong(tree.GetSafeHwnd(),GWL_STYLE,TVS_HASLINES |TVS_LINESATROOT);
}
Iv tried using this to set the styles as in the above code, but the program
gets corrupted.
How can i set the style of a CTreeCtrl nested in a CTreeView?