I have a planner in Timeline mode and the sidebar on the top. Now I want to display the Date and the calender week in the sidebar. I can format the date to be displayed with day of week and the actual date, but I did not find a way to display the calender week. When I try to use the OnPlannerSideDrawAfter event, the frst problem is, that is pretty hard to get the text centered and the even bigger problem is, that the text disapears, when clicking in a column below the text and the selection marker is drawn over it (BTW, how can I remove the selection marker in the sidebar?). And it does not get drawn again. So is there a simple way to bring the calender week to the sidebar? It could be together with the date or just below it.
Another problem is, that the time is displayed not very nice in the sidebar. I have Display.DisplayUnit set to 15. When I set Display.DisplayText to 0 the time is cut, because it does not fit. When I set it to 4, so that it is displayed only for every hour, it does not show 01:00 but only shows 1, what is a bit ugly.
Any suggestions on that?
What exact code do you use in OnPlannerSideDrawAfter?
You need to take in account this event is triggered for every sidebar timeslot, so, if you want to draw text that spans over different timeslots, you need to take that in account using the right coordinates in your OnPlannerSideDrawAfter event (it will need to be drawn in every sidebar timeslot cell where the text should appear)
To be honest, I did not find a way to write the text centered so far. Tried several things, but nothing seems to work.
Here is what I got so far, but the positioning is way out of the center.
I made many steps to calculate the single values, just for easier debugging.
procedure TForm1.PlannerPlannerSideDrawAfter(Sender: TObject;
Canvas: TCanvas; Rect: TRect; Index: Integer);
var
temp,
cwleft,
cwdiff,
cwwidth : integer;
s : string;
begin
temp := round (24 * 60 / Planner.Display.DisplayUnit);
if ((index + 1) mod temp = 0) then
begin
s := 'KW xx';
cwwidth := Rect.Width * temp;
temp := (index + 1) div temp;
cwdiff := canvas.TextWidth(s);
cwdiff := (cwwidth - cwdiff) div 2;
cwleft := temp * cwwidth - cwdiff;
Canvas.TextOut(cwleft ,Rect.Top + 20, s);
end;
end;
Besides the positioning, there is another problem. Whenever I click into a cell below the Text, I drawed in that event, The Text is erased by the select marker in the sidebar.
So the next main question is: how can I disable the selection marker in the sidebar?
Any chance to get that solved? I just want to do it using the OnPlannerSideDraw event. Unfortunately there is a selection indicator in the sidebar, that wipes out the drawn text, as soon as it goes over the text. Is there a way to disable that selection indicator in the sidebar? Did not find any coresponding property.