CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    731

    Tree control item image changes when I click it

    I have associated an image list with a tree control. It is loaded fine but when I click any of the item, the image associated with that time changes to the first image in image list. I don't know why would this happen? I am not even handling LButton click message. Any ideas why is this happening? thanks

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Quote Originally Posted by retry
    Any ideas why is this happening? thanks
    Because when you click an item, it will be selected, and the tree control will display it using the 'selected' image, if defined. When calling InsertItem(), you can pass the index for the normal image and for the selected image - I suspect you're passing 0 for the latter, causing the first image to be displayed whenever an item is selected.
    Last edited by gstercken; July 29th, 2004 at 10:59 AM.

  3. #3
    Join Date
    Jul 2003
    Posts
    731
    Thanks gstercken, that was it!

    but I was not expecting this since I am not using the TVIF_SELECTEDIMAGE mask, it should be disabled automatically! than even -1 is not working it displays empty white image or no image in other words.

    I set the iSelectedImage to same as iImage so they both are same for each node.

    thanks again!

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