AdvTreeView Icon Changing

Hello!


Is it possible to change node icon from time to time?

Please explain from time to time?


Icons are used to signal the state of a particular tree node. 
Depending on the situation, the icon should change.

Yes, you can change the node icon, you can do this in collection based mode by directly changing the ExpandedNodeIcons or CollapsedNodeIcons property or via events.


Excellent!
The documentation does not contain these parameters.
Can you please make a little example for collection based mode?
And how to generate event for updating icon?

The code access the expanded node icon is


AdvTreeView1.Nodes[0].ExpandedIcons[0, False].LoadFromFile('MyImage.png');


and for collapsed state


AdvTreeView1.Nodes[0].CollapsedIcons[0, False].LoadFromFile('MyImage.png');


Updating the node is done with the above methods

Pieter Scheldeman2018-04-26 16:36:20


Pieter! Thank you!
Is it possible load icon from PictureContainer?

And how it's will be in c++ builder syntax?

Sorry for previous q. Problem solved.

 thanx!

Thank you for your feedback.

I also have a question on this subject, so I'll continue to write here.
Via AfterSelectNode I get aNode.node .
procedure ctv_directoriesAfterSelectNode
if Assigned(ANode.Node) then
begin
nNode:= ANode.Node;
GetCursorPos(point);
pm_Type.Popup(Point.X,Point.Y);
end;
I can use this to change the text in a column using a pop-up menu: nKnoten.Text[4]:=' ' (aNode.node) change the text.
Now how do I manage to change the icon of exactly these nodes?

if (Sender as TMenuItem).Caption = 'Correspondence' then
begin
// set new entry
cb_Font.Checked:= true;
nKnoten.Text[4]:= 'Correspondence';
? node.ImageIndex := 0; -> I'm looking for something like that
end;

Thanks
Mike

The Icon can be assigned to the CollapsedIcon / ExpandedIcon property. If you only assign the CollapsedIcon, this will be used for both states. If you have assigned a TPictureContainer, you can use CollapsedIconName instead.

Sorry, I only saw this now. Thanks for the help.
Mike