Mick
Mick

Reputation: 13495

Is it possible to use animated icons with VirtualTreeView nodes?

I am using the awesome VirtualTreeView component with Delphi 2010. Currently, my nodes are setup with a standard image in a TImageList. What I'd like to do is to be able to show some type of spinning animated icon to show visually that a node is "busy".

Obviously the node won't be busy, but what the node represents to the user will actually be busy. Is there an easy way to do this?

The only way I can think of is to create add 8-10 images represent a spinning wheel to my current TImageList and then cycle through them for that node.

Does anyone have any suggestions?

Upvotes: 1

Views: 827

Answers (1)

Ondrej Kelle
Ondrej Kelle

Reputation: 37221

Probably you can do the animation yourself. For example you could store the animation status in the node data. Then you could repeatedly (from a timer) iterate the whole tree (IterateSubTree) and from the callback check the node data and if the node should be animated call RepaintNode (to force repainting immediately) or InvalidateNode (to invalidate the node so it's painted in the next paint cycle). The actual painting could be done as usual from an OnGetImageIndex event handler, returning different image indexes for different stages of the animation cycle.

Upvotes: 3

Related Questions