Recent

Author Topic: TtreeView and images  (Read 7965 times)

BlueIcaro

  • Hero Member
  • *****
  • Posts: 735
    • My github
TtreeView and images
« on: August 17, 2010, 03:40:10 pm »
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

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

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: TtreeView and images
« Reply #1 on: August 17, 2010, 08:40:41 pm »
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: [Select]
      NewNode:=TreeView1.Items.Add(Nil, Edit1.Text );
      NewNode.ImageIndex :=0;
      NewNode.SelectedIndex :=1;
      NewNode.StateIndex :=2;

Hope this helps.

-- alejandro.lavarello (at) gmail (dot) com
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

BlueIcaro

  • Hero Member
  • *****
  • Posts: 735
    • My github
Re: TtreeView and images
« Reply #2 on: August 17, 2010, 09:50:36 pm »
Thank you for the information. It was veru usefull

/BlueIcaro

 

TinyPortal © 2005-2018