CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: CTreeCtrl

  1. #1
    Join Date
    May 1999
    Posts
    8

    CTreeCtrl

    Hi,
    I insert objects address as lParam in CTreeList and when I try to get it at OnDblclk.
    by this code

    NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
    TVITEMA* pItemNew = &pNMTreeView->itemNew;
    CCityOb* pCity = (CCityOb*) pItemNew->lParam;

    pCity don't return as vaild object, any one can help me
    thanks.


  2. #2
    Join Date
    May 1999
    Posts
    26

    Re: CTreeCtrl

    I had the same problem.
    This is a little tricky but works:


    OnItemDoubleClick()
    {
    HTREEITEM item;
    item = m_Tree.GetSelectedItem();

    //...
    }




    This way you can know the item by text using


    CString ItemText = m_Tree.GetItemText(item)




    but i don't remember if the HTREEITEM structure allows you to get the index.

    Hope it helps.



  3. #3
    Guest

    Re: CTreeCtrl

    how do you poke the data in there?



  4. #4
    Join Date
    May 1999
    Location
    OR, USA
    Posts
    65

    Re: CTreeCtrl

    When inserting the item in the control use this

    CCityOb* pCity = new CCityOb;
    //call any methods or initialize CCityOb
    //and then
    ...->lParam = pCity;



    where lParam is from the item u r inserting.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured