Re:Treeview Adding Image to Node
First assign your images to your TImageList and then set your
TTreeView->Images property equal to this TImageList. You can now assign the
images to your TreeNodes either at:
DESIGN TIME:
by Double Clicking on the TTreeView Component (or Right Clicking on the
TreeView component and select the Items Editor from the context menu). This
opens up the TreeView Items Editor dialog where you can add your nodes and
then set the nodes images by setting the Image Index, Selected Index and the
State Index.
These all take an interger value which correpsonds to the images postion in
the TImageList... ie the 1st image in the TImageList is at position 0, the
2nd at 1, the 3rd at 2 ... an so on. So to set a TreeNode's image to be the
2nd in the TImageList you would set it to 1.
Image Index - Is the Image displayed next to the node when the node is NOT
currently selected.
Selected Index - Is the Image displayed next to the node when the node IS
currently selected.
State Index - I am not to sure about as I haven't used it but you can check
the help.
RUN TIME:
To set the images at runtime 1st get the TreeNode you wish to assign the
images to via the
TTreeView->Items->Item[i] //where 'i' is the number the node is in the
TTreeView list.
From this TreeNode you can then set the properties described above like
this:
TTreeView->Items->Item[i]->SelectedIndex = 3;
TTreeView->Items->Item[i]->ImageIndex = 2;
In summary you need to look at the specific TTreeNode component to set the
images instead of the TTreeview.
All the best
Scott Kent-Collins
Quote
"CheGueVerra" <chegueve...@hotmail.com> wrote in message
news:3b2e885b_2@dnews...
Quote
> I was looking at the properties of a TTreeView and saw that there is only
an
> Images property... I searched google to try to find how to add an Image
> from an ImageList to a specific node, but didn't find anything.
> I want to assign a certain Icon to a Node and an other to the ChildNodes
> underneath it.
> Thanks for the Help
> CheGueVerra