0
votes

I created a tree control in VC++, but I cant select the child nodes. Any suggestions?

m_pTree->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
                 TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT |
                 TVS_SINGLEEXPAND | TVS_SHOWSELALWAYS | 
         TVS_TRACKSELECT,CRect(10, 10, 200, 240), this, 0x1221);

hTree=m_pTree->InsertItem(_T("SoftWare Production") , TVI_ROOT);
hCompany=m_pTree->InsertItem(_T("Microsoft"),hTree);
m_pTree->InsertItem(_T("Office") , hCompany);
m_pTree->InsertItem(_T("Visual Studio") , hCompany);
m_pTree->InsertItem(_T("Servers") ,hCompany , TVI_LAST);

m_pTree->Expand(hCompany, TVE_EXPAND);

hCompany=m_pTree->InsertItem(_T("Linux"),hTree);
m_pTree->InsertItem(_T("Open Office") , hCompany);
m_pTree->InsertItem(_T("QMail") , hCompany);
m_pTree->InsertItem(_T("Apache") ,hCompany,TVI_LAST);



m_pTree->Expand(hCompany, TVE_EXPAND);
1
select it programatically? show some code?Jeeva
You have to edit your answer and paste the code. dont do it in commentJeeva
I need to select them when my program runsSudix
Works fine for me. After running my application i am able to select the items using mouseJeeva
Really??? I cant do.. Only the Parent node is SelectableSudix

1 Answers

1
votes

I think m_pTree->SelectItem(HTREEITEM) should work