I'm trying to insert a CTreeCtrl into a pane in a Splitter window. I've
created a CTreeControl class and have inplemented the OnCreate function
below :-
int CCWTree::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
HTREEITEM hRootItem;
HTREEITEM hItem;
if (CTreeCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
hRootItem=InsertItem("The Root Item", TVI_ROOT, TVI_LAST);
hItem=InsertItem("Blackbird", hRootItem, TVI_LAST);
hItem=InsertItem("Robin", hItem, TVI_LAST);
hItem=InsertItem("Crow", hRootItem, TVI_LAST);
hItem=InsertItem("Raven", hItem, TVI_LAST);
hItem=InsertItem("Magpie", hItem, TVI_LAST);
ShowWindow(SW_SHOW);
UpdateWindow();
return 0;
}
I put my TreeCtrl into the pane from the CMainFrame::OnCreateClient method.
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*
pContext)
{
if (!pContext) return FALSE;
// m_SplitterWnd.Create(this, 1,2,CSize(10,10),pContext);
m_SplitterWnd.CreateStatic(this,1,2);//, CSize(10,10)), pContext);
m_SplitterWnd.CreateView(0,0,RUNTIME_CLASS(CCWTree),CSize(10,30),pContext);
m_SplitterWnd.CreateView(0,1,RUNTIME_CLASS(CCWTree2),CSize(10,30),pContext);
return TRUE;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}
The Result
I get two blank splitter panes and no TreeControl and when I move the
splitter bar the window is not updated so I get a ghost splitter bar thing.
Runnning it in debug it always fails to insert an item as the HTREEITEM is
always null after each call to InsertItem(), but I don't know why. Please
can anyone point me in the right direction ??
Many thanks in advance
-Chris
--
TSEKIT: http://personal-pages.ps.ic.ac.uk/~umeca74/
2xExplorer RR-t just made windows Explorer obsolete
Sent via Deja.com http://www.deja.com/
Before you buy.