Link to home
Create AccountLog in
Avatar of AuthorwareXtras
AuthorwareXtras

asked on

TreeView and ListView - at runtime

I have a ListView populated with images and I want at runtime to populate a TreeView with an image from the listview and associated 'Label'
 
Once populated I need to check which item the user clicked.
I read elsewhere about an issue of the Image changing when it is selected?  I don't want that to happen...When I set these up at design time it doesn't seem to, but is there something I should know here?
Also, is there a method to 'deselect' the currently selected item to effectively 'clear' the control

depending on answers recieved, I may need to follow up, but I don't know what I need to ask yet ;-)

Thanks

:-)
Avatar of Mike Littlewood
Mike Littlewood
Flag of United Kingdom of Great Britain and Northern Ireland image

> I read elsewhere about an issue of the Image changing when it is selected?
Not that I know of, you just have to play around with the Treeview/Listview .imageindex and .selectedindex

> Also, is there a method to 'deselect' the currently selected item to effectively 'clear' the control
Treeview.Selected := nil
Listview.Selected := nil
> Once populated I need to check which item the user clicked.
Treeview/Listview .OnClick or .OnChanging
Avatar of AuthorwareXtras
AuthorwareXtras

ASKER

Where I said ListView in my original question, I should have said ImageList.....sorry....It was late!
ASKER CERTIFIED SOLUTION
Avatar of Mike Littlewood
Mike Littlewood
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I forgot to say for this part of your question

> I read elsewhere about an issue of the Image changing when it is selected?

it is not an issue, that is how the tree works.
This is so you can have a different image to be shown when a node is selected, just like windows explorer.