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

    Tree control - How to edit label?

    I have problems with editing label of a tree control item. I am getting the the new label only if I type some new characters. If I just leave the old characters as it is, I am getting only a NULL string in OnEndlabeleditTree(). Do somebody have a solution for this?
    Thanks,
    Tony


  2. #2
    Join Date
    May 1999
    Posts
    11

    Re: Tree control - How to edit label?

    If you leave the old characters as it is,the edit cotrol will send a NULL string to the tree control,so you must overide the CTreeCtrl::OnEndlabeledit(...)just lik this:

    void CMyTreeCtrl::OnEndlabeledit(NUMHDR *pNMHDR,LRESULT *pResult)
    {
    TV_DISPINFO *pTVDispInfo=(TV_DISPINFO*)pNMHDR;
    CString strItem=pTVDispInfo->item.pszText;
    if(!strItem.IsEmpth())//if the string is //empty,do nothing!
    {
    SetItemText(pTVDispInfo- >item.hItem,strItem);
    }
    }





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