[TTMSFNCPlanner] TTMSFNCCustomPlanner.CallBeforeSizeLinkedItems

Hello,
I have a strange bug.
It's in the TTMSFNCCustomPlanner.CallBeforeSizeLinkedItems method which is called because I do use my own OnBeforeSizeItem event.

The first test in the CallBeforeSizeLinkedItems method is passed (if not Assigned(AItem) or not Assigned(AItem.LinkedItem) then
Exit;)
but it's not a item with a link item ... So it crashes just after.
A idea ?
Thank you
Alexandre Boisramé

The code should indeed just be skipped, so it's unclear why LinkedItem would be assigned.It should only be assigned when you assign it in code. Do you modify the code for the planner or override methods?

I don't modify your code.
I don't think I override methods but I will search that way to be sure.
I just assign a lot of event methods :

In a class TRacine = class(TTMSFNCPlanner)

self.OnAfterDrawCell := onRacineAfterDrawCell;
self.OnAfterDrawPositionEmptySpace := onRacineAfterDrawPositionEmptySpace;
self.OnAfterDrawGroupEmptySpace := onRacineAfterDrawGroupEmptySpace;
self.OnAfterDrawCellVerticalLine := onRacineAfterDrawCellVerticalLine;
self.OnAfterDrawCellHorizontalLine := onRacineAfterDrawCellHorizontalLine;
self.OnAfterDrawPosition := onRacineAfterDrawPosition;
self.OnAfterMoveItem := onRacineAfterMoveItem;
self.OnAfterSizeItem := onRacineAfterSizeItem;
self.OnAfterDrawItem := onRacineAfterDrawItem;
self.OnBeforeDrawGroup := onRacineBeforeDrawGroup;
self.OnBeforeDrawItemText := onRacineBeforeDrawItemText;
self.OnBeforeDrawPosition := onRacineBeforeDrawPosition;
self.OnBeforeDrawPositionText := onRacineBeforeDrawPositionText;
self.OnBeforeDeleteItem := onRacineBeforeDeleteItem;
self.OnBeforeDrawItem := onRacineBeforeDrawItem;
self.OnBeforeSizeItem := onRacineBeforeSizeItem;
self.OnBeforeMoveItem := onRacineBeforeMoveItem;
self.OnKeyPress := onRacineKeyPress;
self.OnGetPositionText := onRacineGetPositionText;
self.OnGetPositionHint := onRacineGetPositionHint;
self.OnItemClick := onRacineItemClick;
self.OnMouseDown := onRacineMouseDown;
self.OnMouseMove := onRacineMouseMove;
self.OnMoveItem := onRacineMoveItem;
self.OnSizeItem := onRacineSizeItem;

And in another class TSemainier = class(TRacine)

self.OnAfterDrawGroup := onSemainierAfterDrawGroup;
self.OnBeforeDrawCell := onSemainierBeforeDrawCell;
self.OnBeforeDrawGroupText := onSemainierBeforeDrawGroupText;
self.OnCustomizeItemRect := onSemainierCustomizeItemRect;
self.OnGetGroupHint := onSemainierGetGroupHint;
self.OnHoverItemChanged := onSemainierHoverItemChanged;
self.OnItemDblClick := onSemainierItemDblClick;
self.OnPositionDblClick := onSemainierPositionDblClick;

I have no linked items in my project.
To be sure I do had the line
item.LinkedItem := nil;
when I add a item but it changes nothing.

I think the problem comes from a memory problem not directly linked to TTMSFNCPlanner but I can't find any real idea to solve. But I have no memory leaks.
Alexandre Boisramé

I'm sure you understand, that we cannot patch or find a workaround in our code related to a memory issue in your application. Please try to isolate your memory issue or isolate the issue in the planner so we can take a look at it.

Of course I know you can't do a lot .. you are not a magician :slight_smile:
Thank you for your answer
Alexandre Boisramé

1 Like