topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 10:48 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Another Question: State/Selection Images in TreeView  (Read 14356 times)

fmwyso

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Another Question: State/Selection Images in TreeView
« on: November 09, 2008, 02:14 PM »
 I have a TreeView (TreeView1) and an ImageList (ImageList1)... The images are all correlated correctly and everything, but my problem is that when a TreeView item is selected the "icon" changes. I would to disable or turn off that option... Just like before, I'm sure it is a small thing but State was the only one I could find and it didn't work for me ><. I also tried disabling all "masking" stuff, but that didn't work either for me ><..

 So, if you know how to disable the selection image change please tell me :D. If possible, I would also like to know what "masking" and "StateImages" are for?

 Thank you for your help,

    fmwyso

 (if mouser happens to be the one who answers/reads this... That is freken awesome that your getting a P.h.D (I think that's spelling) in CS. I am planning on getting my Masters... Going to comm. college next season to start my 6-10 years of pain, depending on speed of course, to get my P.h.D/Masters in CS... Only prob I have is that I'll have to start out with classes for VB X_X)
« Last Edit: November 09, 2008, 03:24 PM by fmwyso »

fmwyso

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #1 on: November 24, 2008, 06:50 PM »
 Hmmm... I guess no body understands my question?

 I have a TreeView with images on each item... When the item is selected, for some reason, it changes the image of that item. I want to turn that change off, does anyone know how to?

marylee

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #2 on: January 27, 2009, 03:12 AM »
Hello you!
I have exactly the same problem, but cannot find nowhere a solution!
Could anybody help?
Or has anybody an idea how to solve it?
Thanks a lot,
marylee

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #3 on: January 27, 2009, 03:16 AM »
Why not just set the same image for all states?

marylee

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #4 on: January 27, 2009, 03:25 AM »
Because I have two different kinds of images, depending on the item itself.
And I combine the image directly with the new node when creating the tree.
The image is just red and green, and is symbolizising the "status" of the item.
And this has nothing to do with the automatical status "selected/unselected"....

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #5 on: January 27, 2009, 03:27 AM »
Copied from Dephi 6 Help file:

TCustomTreeView.StateImages

Determines which image list to use for state images.

property StateImages: TCustomImageList;

Description

Use StateImages to provide a set of bitmaps that reflect the state of tree view nodes. The state image appears as an additional image to the left of the item's icon.

TCustomImageList is the base class for collections of same-sized images, each of which can be referred to by its index.

Unit

ImgList

Description

Image lists are used to efficiently manage large sets of icons or bitmaps. All images in an image list are contained in a single, wide bitmap in screen device format. An image list may also include a monochrome bitmap that contains masks that are combined with the images to produce a transparent effect such as is common in icons.


marylee

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #6 on: January 27, 2009, 06:01 AM »
Hello,

I'm using treeView1.ImageList not treeView1.StateImageList. However the images change..

marylee

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: Another Question: State/Selection Images in TreeView
« Reply #7 on: January 30, 2009, 05:52 AM »
Ok, now I have the solution!
In the Add Method of the TreeNodes you cannot specify only the index of the image of the node, but also the image of the selectedNode!
tn.Nodes.Add("name", "Node Text", 1, 1);
 :)