Thanks, Pieter. I installed FNC Core 4.5.0.1 together with Gantt 1.3.3.11 and ran the demo from this thread again: in scene 1, rectangle B is now drawn in the PDF. In scene 2, the PDF now shows A with a hole, B filled and C with a hole, and on screen B is filled as well. So both issues are fixed, thank you.
Unfortunately the SVG changes in 4.5.0.1 cause a new problem in our application, which also uses TMS VCL UI Pack 13.7.0.0 (Delphi 13.1, VCL, Win64). As soon as a Gantt task list with a summary task is painted, there is an access violation in TTMSFNCGraphicsSVGImport.InternalDraw, line 3055 (if est.DisplayValue = 'none' then), while the expand/collapse icon is drawn:
System._UStrEqual
TTMSFNCGraphicsSVGImport.InternalDraw
TTMSFNCGraphicsSVGImport.InternalDraw
TTMSFNCGraphicsSVGImport.Draw
TTMSFNCGraphics.DrawSVG
TTMSFNCGraphics.DrawBitmap
TTMSFNCGraphics.DrawBitmap
TTMSFNCCustomGanttChart.DoOnTaskListBeforeDrawNodeExpand
TTMSFNCCustomGanttList.DoBeforeDrawNodeExpand
...
With FNC Core 4.5.0.0 / Gantt 1.3.3.10 the same application works. As far as we can see, this is the cause:
AdvTypes.pas(VCL UI Pack) declaresIAdvSVGBitmapwith the same GUID asITMSFNCSVGBitmapinVCL.TMSFNCTypes.pas:{3A7B5F92-C4E1-4D8A-B623-0F1E7A9D4C85}.- Both units declare a class named
TTMSFNCSVGBitmap(inAdvTypesit isclass(TAdvSVGBitmap)) and register it withRegisterClassandTPicture.RegisterFileFormat('SVG', ...), but only if no class with this name is registered yet. So the unit that is initialized first wins. In our application this isAdvTypes. TTMSFNCGraphics.DrawSVGgets the SVG withSupports(ABitmap.Graphic, ITMSFNCSVGBitmap, ISVGBitmap)and casts the result ofGetSVGtoTTMSFNCGraphicsSVGImport. With the UI Pack class registered, it is aTAdvGraphicsSVGImport. In the debugger, the element list being drawn belongs toAdvGraphicsSVGEngine.- In VCL UI Pack 13.7.0.0, the declarations of
TAdvGraphicsSVGImportandTAdvGraphicsSVGElementare identical toTTMSFNCGraphicsSVGImportandTTMSFNCGraphicsSVGElementof FNC Core 4.5.0.0 (apart from the prefix), so this worked until now. FNC Core 4.5.0.1 added five fields toTTMSFNCGraphicsSVGElement(FStrokeDashArrayValue,FStrokeDashOffsetValue,FStrokeLineCapValue,FFillRuleValue,FClipRuleValue). The FNC code now reads the UI Pack objects at the wrong offsets.
Demo (attached), built as Win64 Debug. Both projects use the same form. The first log line shows which unit registered TTMSFNCSVGBitmap, and exceptions are shown and written to the log.
SVGExpandIcon.dpruses FNC only. Button 1 loads the Gantt expand icon SVG (TTMSFNCGANTTLISTEXPANDNEWSVG) into aTTMSFNCBitmapand draws it withTTMSFNCGraphics.DrawBitmap. Button 2 shows a Gantt chart with one summary task. Both work, the icons are drawn:
TTMSFNCSVGBitmap registered from unit: VCL.TMSFNCTypes
1. DrawBitmap
loaded, graphic class: TTMSFNCSVGBitmap (unit VCL.TMSFNCTypes)
drawing ...
OK
2. Gantt with summary task
OK
SVGExpandIconUIPack.dpris the same, the only difference isAdvTypesas the first unit in the uses clause. Button 1 raises the access violation (German Windows):
TTMSFNCSVGBitmap registered from unit: AdvTypes
1. DrawBitmap
loaded, graphic class: TTMSFNCSVGBitmap (unit AdvTypes)
drawing ...
EAccessViolation: Zugriffsverletzung bei Adresse 00007FF66D8937AD in Modul 'SVGExpandIconUIPack.exe' (Offset 137AD). Lesen von Adresse FFFFFFFFFFFFFFFF
In the debugger the call stack is the one above, from TTMSFNCGraphics.DrawBitmap down to System._UStrEqual.
Questions:
- Is there (or will there be) a VCL UI Pack version whose SVG engine matches FNC Core 4.5.0.1? Which versions of the two products belong together?
- Could the products avoid casting each other's objects (separate GUIDs and class names, or a check of the actual class before the cast)? Today an update of one product can break the other at runtime, without any compiler error.
- Until then: is Gantt 1.3.3.11 supported with FNC Core 4.5.0.0?
Versions: Delphi 13.1, TMS FNC Core 4.5.0.1, TMS FNC Gantt Chart 1.3.3.11, TMS VCL UI Pack 13.7.0.0, all installed with TMS Smart Setup.
Thanks!
SVGExpandIcon_Demo.zip (7.1 KB)