Forum > LCL

TtreeView and images

(1/1)

BlueIcaro:
Hello, When I add some elements to my TTreeView, in design time I can select the image for the element, the image when this element is selected, and the image for state.

But When I add a element in runtime, I can select a image for this element, for example:

--- Quote --- NodeImageIndex:=1

--- End quote ---

But I don't find any property to select for the other images, selected image, state image.

I use Lazarus 0.9.28.3 Svn:26768 in windows XP

Thanks

/BlueIcaro

alejol0:
First, put some ImageList controls in your form and fill them with
icons.

At design time, you can attach the TreeView to an ImageList
for storing node images:
  TreeView1.StateImages :=ImageList1
  TreeView1.Images :=ImageList1
(set this using Object Inspector)

Then, in runtime, you can assign and change node images
changing the index:

--- Code: ---      NewNode:=TreeView1.Items.Add(Nil, Edit1.Text );
      NewNode.ImageIndex :=0;
      NewNode.SelectedIndex :=1;
      NewNode.StateIndex :=2;

--- End code ---

Hope this helps.

-- alejandro.lavarello (at) gmail (dot) com

BlueIcaro:
Thank you for the information. It was veru usefull

/BlueIcaro

Navigation

[0] Message Index

Go to full version