[Lazarus] WorksheetGrid and Frames

Werner Pamler werner.pamler at freenet.de
Fri May 27 12:43:46 CEST 2016

As noted by a user in the forum 
TsWorksheetGrid (the grid of the fpspreadsheet package) fails if used 
within frames. I am aware that normally I myself take care of 
fpspreadsheet, but in this case I am lost because I am not so familiar 
with the TFrame architecture.

Whoever wants to look into this issue please note that the package 
laz_fpspreadsheet_visual (from ccr) must be installed.

Run the attached demo to reproduce the bug.

- Click on button  "ShowWorksheetGridFrame". This should open a form 
with an inserted TsWorksheetGrid. Hower, there is an error message 
*"Control 'WorksheetGrid_Frame ' has not parent window"*. The fact that 
you can open the project at all is because I removed the form with the 
TsWorksheetGrid from the project. With this form included I crashed Lazarus.

- The bug occurs only if the WorksheetGrid is added to the form at 
designtime. Open unit "main". In "BtnWorksheetGridFrameClick", comment 
the line "frame := TWorksheetGrid_Frame.Create(self)" and uncomment the 
line "frame := TWorksheetGrid_Frame_Runtime.Create(self)". This 
activates code creating the worksheetgrid at runtime. If you run the 
demo and click the button, everything is ok.

- TsWorksheetGrid inherits from TsCustomDrawGrid, just like TsDrawGrid. 
Button "ShowDrawGridFrame" inserts a frame containing a 
design-time-created TDrawGrid. Everything is ok.

The crash happens in "InitInheritedComponent" of classes. Is there 
anything which has to be initialized in TsWorksheetGrid to pass this 
test? But then, why is TDrawGrid ok which just publishes inherited 
properties; all the code is in its ancestor which is shared with the 
failing TsWorksheetGrid.

Any help would be appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160527/a45ea013/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: frame_worksheetGrid.zip
Type: application/x-zip-compressed
Size: 4075 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160527/a45ea013/attachment-0001.bin>

More information about the Lazarus mailing list