Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Tree Collapsing if i delete any node of the Tree.

Tree Collapsing if i delete any node of the Tree.

Scheduled Pinned Locked Moved C / C++ / MFC
data-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Royaltvk
    wrote on last edited by
    #1

    Hi, Iam Using CTreeView to Construct a Tree. If i delete any node in the tree it is collapsing. void CRunSetView::DeleteFilters(HTREEITEM hselected) { CTreeCtrl& TreeCtrl = GetTreeCtrl(); HTREEITEM Parent = TreeCtrl.GetParentItem(hselected); short nRunsetId = GetItemID(Parent); HTREEITEM ChildItem = TreeCtrl.GetChildItem(hselected); do { short nMapId = GetItemID(ChildItem); CMigratorClient* pManager = GetDocument()->GetManagerPtr(); CMigratorDoc* cmap = GetDocument(); _RecordsetPtr rsMap; rsMap.CreateInstance(__uuidof(Recordset)); CString strSQL; strSQL.Format(_T("SELECT * FROM DQMap WHERE ID = %d"),nMapId); rsMap->Open( _variant_t( strSQL ), _variant_t(( IDispatch *) pManager->GetDatabasePtr(), true), adOpenStatic, adLockOptimistic, adCmdText); if ( !rsMap->GetEndOfFile() ) { CString MapNm = VariantToStr( rsMap->Fields->Item["FilterName"]->Value ); rsMap->Close(); _RecordsetPtr rsMapDQ; rsMapDQ.CreateInstance(__uuidof(Recordset)); strSQL.Format(_T("SELECT * FROM DQMap WHERE FilterName = '%s'"),MapNm); rsMapDQ->Open( _variant_t( strSQL ), _variant_t(( IDispatch *) pManager->GetDatabasePtr(), true), adOpenStatic, adLockOptimistic, adCmdText); while( !rsMapDQ->GetEndOfFile() ) { nMapId = _ttoi( VariantToStr( rsMapDQ->Fields->Item["ID"]->Value )); short mapid; CMigratorClient* pManager = GetDocument()->GetManagerPtr(); pManager->DeleteRunSetMap(nRunsetId,nMapId); cmap->deletefilters(nMapId); rsMapDQ->MoveNext(); } rsMapDQ->Close(); } }while((ChildItem = TreeCtrl.GetNextSiblingItem(ChildItem))!=NULL); HTREEITEM item = GetRootItem(); DeleteItem(item); OnInitialUpdate(); return; } Plz look at it , give any idea.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups