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. CTreeCtrl selection problem

CTreeCtrl selection problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiondata-structures
4 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
    RoyceF
    wrote on last edited by
    #1

    Hi, I have a problem with a CTreeCtrl in a FormView. When the view is initially shown and the user clicks a button to expand a branch of the tree, the item is expanded, but also the first item in the tree is selected. I don't want this behavior. Rather, I don't want an item to be selected until the user explicitly selects one by clicking it. How can I fix this? Thanks, Royce

    I 1 Reply Last reply
    0
    • R RoyceF

      Hi, I have a problem with a CTreeCtrl in a FormView. When the view is initially shown and the user clicks a button to expand a branch of the tree, the item is expanded, but also the first item in the tree is selected. I don't want this behavior. Rather, I don't want an item to be selected until the user explicitly selects one by clicking it. How can I fix this? Thanks, Royce

      I Offline
      I Offline
      includeh10
      wrote on last edited by
      #2

      it should work: check clicking position, if clicking on button then move focus back to previous selected item.

      R 2 Replies Last reply
      0
      • I includeh10

        it should work: check clicking position, if clicking on button then move focus back to previous selected item.

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

        This is when the control is first displayed, so there is no previous item. Anyway, it appears that by default the first item is selected when the first expansion happens. It happens after the expansion is handled because there is no selection during the handling of the TVN_ITEMEXPANDED message. At any rate, I fixed the problem by adding a root item without any text. That root item gets selected, but because it has no text, it doesn't appear selected. Thanks for your help, Royce

        1 Reply Last reply
        0
        • I includeh10

          it should work: check clicking position, if clicking on button then move focus back to previous selected item.

          R Offline
          R Offline
          RoyceF
          wrote on last edited by
          #4

          This is when the control is first displayed, so there is no previous item. Anyway, it appears that by default the first item is selected when the first expansion happens. It happens after the expansion is handled because there is no selection during the handling of the TVN_ITEMEXPANDED message. At any rate, I fixed the problem by adding a root item without any text. That root item gets selected, but because it has no text, it doesn't appear selected. Thanks for your help, Royce

          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