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. Editing the labels

Editing the labels

Scheduled Pinned Locked Moved C / C++ / MFC
data-structurestutorial
7 Posts 2 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
    ratprita
    wrote on last edited by
    #1

    Anyone know how to edit the labels of the TreeCntrl and add userdata in the tree.

    T 1 Reply Last reply
    0
    • R ratprita

      Anyone know how to edit the labels of the TreeCntrl and add userdata in the tree.

      T Offline
      T Offline
      theCPkid
      wrote on last edited by
      #2

      What's TreeCntrl? Do you mean CTreeCtrl?

      R 1 Reply Last reply
      0
      • T theCPkid

        What's TreeCntrl? Do you mean CTreeCtrl?

        R Offline
        R Offline
        ratprita
        wrote on last edited by
        #3

        yes, CTreeCntrl

        T 1 Reply Last reply
        0
        • R ratprita

          yes, CTreeCntrl

          T Offline
          T Offline
          theCPkid
          wrote on last edited by
          #4

          CTreeCntrl or CTreeCtrl? :) Anyway, check [this] tutorial on using CTreeCtrl. For editing labels, SetItemText should work?? What problem are you facing?

          R 1 Reply Last reply
          0
          • T theCPkid

            CTreeCntrl or CTreeCtrl? :) Anyway, check [this] tutorial on using CTreeCtrl. For editing labels, SetItemText should work?? What problem are you facing?

            R Offline
            R Offline
            ratprita
            wrote on last edited by
            #5

            Not adding items to the CTreeCntrl. My problem is that , i have an editable tree, ie, i have checked the edit labels option.i want to know how to accept the label change on the tree. Means how to set the changed label?

            T 1 Reply Last reply
            0
            • R ratprita

              Not adding items to the CTreeCntrl. My problem is that , i have an editable tree, ie, i have checked the edit labels option.i want to know how to accept the label change on the tree. Means how to set the changed label?

              T Offline
              T Offline
              theCPkid
              wrote on last edited by
              #6

              I am sorry if I could not get you but do you mean how to edit the labels from user point of view? If it's so, click on the item to select it and then single click again and an in-place edit box will open. :doh: If you mean as a programmer, then you get BeginLabelEdit and endlabel edit messages, you can get the item text, set the item text, get current selection etc etc? something like

              void CMyTreeCtrl::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *pLResult)
              {
              TV_DISPINFO *ptvinfo;
              ptvinfo = (TV_DISPINFO *)pnmhdr;
              if (ptvinfo->item.pszText != NULL)
              {
              ptvinfo->item.mask = TVIF_TEXT;
              SetItem(&ptvinfo->item);
              }
              *pLResult = TRUE;
              }

              R 1 Reply Last reply
              0
              • T theCPkid

                I am sorry if I could not get you but do you mean how to edit the labels from user point of view? If it's so, click on the item to select it and then single click again and an in-place edit box will open. :doh: If you mean as a programmer, then you get BeginLabelEdit and endlabel edit messages, you can get the item text, set the item text, get current selection etc etc? something like

                void CMyTreeCtrl::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *pLResult)
                {
                TV_DISPINFO *ptvinfo;
                ptvinfo = (TV_DISPINFO *)pnmhdr;
                if (ptvinfo->item.pszText != NULL)
                {
                ptvinfo->item.mask = TVIF_TEXT;
                SetItem(&ptvinfo->item);
                }
                *pLResult = TRUE;
                }

                R Offline
                R Offline
                ratprita
                wrote on last edited by
                #7

                Thanks a lot. Its working now

                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