FNC Planner Item Hints

Hello,

I want to show Hints when moving the mouse over a planner item. I did not find a way to do so.
The Hint text should be set in a OnShowHint event or something like that, because I have to set the hint text depending on data of the item.
I could not find anything helpful in the documentation about that.
Please point me into the right direction.

The TTMSFNCPlannerItem has a Hint property. Which can be set to show a hint when hovering an item.

Yes I know, that there is a Hint Property. The problem is, that this must be set during the creation of the Item. When there are a lot of items on a planner and the text for the Hint needs some reading from a database that slows down the creation of the planner with all those items. For that reason, I would like to set the hint whenever it is needed. So it would be great to be able to set the hint, before the hint is shown.


I managed to get this working by creating my own class from TTMSFNCPlanner and override the ShowHint method. In this method I use an OnItemHint event I implemented in my planner class.

Now it works to get the hint when it is displayed.
I have still 2 problems. One of them should be a bug.
First problem is, that I need to display HTML formatted text as hint. The default Item Hint does not use HTML formatted text. So I would have to write my own drawing method too.
Second, and that is probably a bug, I do not get the correct Item into the showhint method.
When Items are very close to each other in the planner, moving from one to the other item, keeps the item that is passed to the showitem method the same. You could easy check that by placing 2 items on a planner and have the starttime of the on the same as the endtime of the other, or at least close to the other. Then move the mouse over one and while the hint is displayed move to the next Item. You will see, that the hint that is displayed is stil the one from the first item.

HTML formatted text is not supported in the planner hints, we'll investigate if we can add support for this. The hint overlapping bug is already fixed internally, an will be available soon in the next release.

Thanks for the fix and thanks for investigating the HTML thing. Would really be a great improvement.

I tried the THTMLHint from my TMS Components pack, but that does not work with the FNC Components. Maybe there is a way to adapt it or just clone it to the FNC components?
I am also messing around with the TMSFNCPopUp. Maybe I can use that to display hints.

When you are making changes in the Planner code, maybe you could invent an OnItemHint event or something like that.
I did it that way:

   TrsPlannerItemHintEvent = procedure(var AItem: TTMSFNCPlannerItem; X, Y: Double; var Handled : boolean) of object;
   TrsFNCPlanner = class (TTMSFNCPlanner)
   protected
      FOnItemHint : TrsPlannerItemHintEvent;
      procedure ShowHint(AItem: TTMSFNCPlannerItem; X, Y: Double); override;
   published
    property OnItemHint : TrsPlannerItemHintEvent read FOnItemHint write FOnItemHint;
   end;

procedure TrsFNCPlanner.ShowHint(AItem: TTMSFNCPlannerItem; X, Y: Double);

var
   handled : boolean;

begin
handled := false;
if assigned (OnItemHint) and assigned (AItem) then
    OnItemHint (AItem, X, Y, handled);
if not handled then
   inherited;
end;

We'll see what is possible here. The hint system that is implemented deviates from the default hint system. We have added TTMSFNCHint to add HTML support, but the planner doesn't use the new hinting system. We'll need to allocate time investigate how we can add support for this.

Ok, thanks for the answqer. Would be great, if it will be in one of the next releases.