TreeView: expand/collapse images not showing up


I'm trying to replace an existing treeview with the TMS FNC TreeView component and I'm having a strange issue:

For some reason, the expand/collapse icons are not showing up anymore on my tree views at runtime (and at runtime ONLY).

To be sure it wasn't a configuration issue, I tried it with simply dropping a TFNCTreeView on the form and running the application: I have the same issue.

When trying in a new project, however, the application works fine.

I am unable to nail it down to a specific unit in my code because of the very large number of units interconnected together. Where in the FNC treeview code could I start looking to find what the problem is and resolve the compatibility issue?

That's very strange. We haven't received similar reports. Can you compare the units, unit order? Perhaps also compare the form file and see if the icon data is included? What happens if you copy a treeview from a new project to your project?

"Can you compare the units, unit order?"


I've spent several hours trying to do just that. Unfortunately, we have a circular unit chain in our main library that I can't get rid of and that makes it impossible to isolate the problematic unit.

That is why I would like to try from the "other end": debug the treeview code to see what could bug it into not loading the picture.

"Perhaps also compare the form file and see if the icon data is included? What happens if you copy a treeview from a new project to your project?"

Oh I did better: I created a new projet altogether and simply dropped a treeview on it. The instant I add any unit that creates that dependancy chain, and run the compiled result, I lose the icons. As soon as I comment out the use clause entry and recompile, the icon reapear.

Can you clarify exactly which unit you have added that creates a "dependancy chain" and also which other units it loads?

Most of these units are units we created for our apps. As to clarify, no I can't really. I mean: I can give you the list and names but it wouldn't mean anything to you.


I have run the projects through the Delphi Unit Dependancy scanner tool and, as soon as I add any unit in the chain to the uses list, I end up with 750+ unit indirectly linked into the application from our libary pathes: too many to find out by hand which one is misbehaving

As far as we have tested here, the expand collapse icons are loading correctly. Maybe there is a unit loaded that interferes with the bitmap / image loading process, something possibly related to manipulating or loading image type files? If we haven't got a test project or more information on the loading sequence we cannot "guess" what happens...

I undestrand that without any test project, it's hard for you to find the issue (and I can't give you the code, I'm afraid).


I have done further testing and found a workaround: the problem seems to be coming from the handling of the PNG file format. If I manually asign BMP images instead of PNGs, then the treenodes are displayed fine.

I also traced two things: 
- The loading of the image from ressource seems to be working fine: the resource is loaded and assigned correctly.
- When panting the image (in TTMSFNCTreeView.DrawNode) a call is made to BitmapToDrawBitmap. That call returns Result := ABitmap.Graphic and, at this point, ABitmap.Graphic is nil. I have no clue as to why that is.

Even weirder: if I reload the PNG resource at runtime (after the form has been initialized), then the image is displayed correctly...


I have written a helper class that reloads the node icons and everything is now working but this is more than strange

There are some weird external forces that are destroying the loading process. I wonder if planet earth has been invaded by some anti-Delphi aliens :). OK, now seriously: we have added SVG a while ago, but I cannot recall issues during our testing phase. Are you using AdvTypes, FNCTypes or another "Types" related unit? If so, in which order are they added?

"Are you using AdvTypes, FNCTypes or another "Types" related unit? If so, in which order are they added?"

VCL.TMSFNCTypes is the only one. It's needed for the treeview and auto-added to the form.

I'm afraid we will really need something with which this can be reproduced.

If I open a support ticket, could we arrange for a remote session?

Please understand that our regular support is offered via this forum or via email.
Live support is equivalent to consulting and is offered as a paid service.

Seems fair. I understand