Treeview Imageindex - image keeps changing

delphi, delphi-xe2, treeview

Solution

The image displayed for the node when it is selected is determined by the SelectedIndex property, So you must set the `SelectedIndex` property value to the same of the `ImageIndex`.

Node.SelectedIndex:=Node.ImageIndex;

Problem

How do I keep a Treeview from reverting to the first image in an image list when a node is selected? When the Group nodes are created, they have an ImegeIndex of 1 ``` Node := TreeView1.Items.Add(nil, 'Software'); Node.ImageIndex:=1; ``` However, when I expand the node it appears the ImageIndex changes to 0 and a different image is displayed. Any idea how to fix that. Thank you.

Original source