FNC Planner Timeline Appearance

I am just about testing the FNC Planner component. I want to display several positions in a timeline, that shows a number of days. The timeline should be on the top. This is nicely done by setting the OrientationMode. The Mode I set to DayPeriod, which seems to work well.

DisplayUnitType will be set to pduHour.
Depending on how many days the user wants to be displayed, I will set the DisplayUnit will be set to 1 up to 12.
My main problem at the moment is, to get a good Header that displays the day and the time of the day.
For Example, if I have 3 days to be displayed, I would like to have the day of week and the date to be displayed on the top of the timeline and for every DisplayUnit the time the DisplayUnit starts with.

For Example something like that:
       Mo, 12.11.2018        |        Di, 13.11.2018       |       Mi, 14.11.2018
00:00|06:00|12:00|18:00|21:00|00:00|06:00|12:00|18:00|21:00|00:00|06:00|12:00|18:00|21:00|

Is there a way to get a timeline like that?

hi,


Unfortunately this is not possible. The time-line can only show one or the other. You can combine Days and the hours of the day separately via the MultiDay mode.

The problem in MultiDay mode is, that the days are displayed on the left side and the time is on the top. I need days and time on the top and positions on the left. Is this possible in any mode?

As already mentioned in the previous post, it is not possible to have both the day and time on the timeline.

Ok, so I have to draw it by myself. Should be ok for me. I discovered OnBeforeDrawTime and OnAfterDrawTime and several other Events, that could be useful. Is there a detailed description what each of this does and what AAllow and ADefaultDraw does? I did not find any detailed description in the DevGuide.


There is no detailed description of these events, but there is a sample in the TMS FNC UI Pack that demonstrates the use of those events. The Allow parameter is to completely block drawing, the ADefaultDraw is to apply graphics, but not draw the elements, so you can draw them yourself. With the Allow parameter you also need to apply graphics such as font, color, ...

Thank you for the info. I will give it a try. Unfortunately there is no sample app with source in the trail version, but I will buy the FNC UI Pack anyway.

I bought the UI pack and the planner works great for me. I managed to draw the timeline, so it fits my needs.

Now I have a question about the color of the items. In the VCL planner I could set Color and ColorTo to get a transition from one color to another. I did not find a ColorTo in the FNC Planner. Is there standard way to draw the items with a color transition or do I have to draw it in an event like I draw the timeline now?
Would be nice to be able to set a ColorTo and an orientation for the color transition.
Probably I have to use HTML bgcolor and bgcolorto?

Hi,


The default appearance of the items is stored under ItemsAppearance. if you want to draw gradients, you can use the following code:

procedure TForm1.TMSFNCPlanner1BeforeDrawItem(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; AItem: TTMSFNCPlannerItem;
  var AAllow, ADefaultDraw: Boolean);
begin
  AGraphics.Fill.ColorTo := gcRed;
  AGraphics.Fill.Kind := gfkGradient;
  AGraphics.Fill.Orientation := gfoVertical;
  AGraphics.Stroke.Color := gcBlack;
end;

Ok, thanks for your answer.

How is the textsize of the item title set, when FontSize = -1 ?

The Tilte is way too large for me. I know I can set the FontSize to a smaller one, but then this size is used, no matter how the size of the rest of the planner is. I would like to set the Font Size of the Title and the Bodytext, but it should stretch in relation to the size of the Position (Positionapperance.Stretch is set to true). Is there an easy way to do this?

The Fontsize can be controlled per item, when it is -1 it takes over the font size of ItemAppearance.TitleFont.Size or ItemAppearance.Font.Size. You could override the OnBeforeDrawItemTitle or OnBeforeDrawItemText event and then calculate the font size based on the available rectangle that is passed as a parameter.

Many thanks for your help. Will try that.

The FNC Planner is amazing, but Iwished there would be a more in detail documentation or a reference or something like that. Then I would not have to ask so many questions here.

I just discovered a problem in the mousewheel event handler.

When I set Handled to true, that has no effect on the handling of the Event in the Planner.
In TTMSFNCCustomControlBase.WMMouseWheel you do not use messaage.result to pass it to HandleMouseWheel.
I think there should be 
b := message.result;
and not
b := false;

I use the mousewheel to increase or decrease the size of the positions when the mouse cursor is somewhere over the positions and CTRL is pressed. Unfortunately it does not only increase or decrease, it also scrolls. To avoid that scrolling in that situation, I set Handled to true, but that has no effect.

Should be 

b := message.result = 1;

Ups, did not work, because Handled is not handled in HandleMouseWheel. So made this change:

  if message.Result = 0 then
     HandleMouseWheel(CreateShiftStateEx, Message.WheelDelta, b);

Now it works.

Hi,


Can you post the correct code you have changed in the WMMouseWheel to get this working?

Here are my changes:


procedure TTMSFNCCustomControlBase.WMMouseWheel(var Message: TWMMouseWheel);
var
  b: Boolean;
begin
  b := message.Result > 0;
  if not b then
     HandleMouseWheel(CreateShiftStateEx, Message.WheelDelta, b);
end;


I guess better would be:
procedure TTMSFNCCustomControlBase.WMMouseWheel(var Message: TWMMouseWheel);
var
  b: Boolean;
begin
  inherited;
  b := message.Result > 0;
  HandleMouseWheel(CreateShiftStateEx, Message.WheelDelta, b);
end;

and 

procedure TTMSFNCCustomPlanner.HandleMouseWheel(Shift: TShiftState; WheelDelta: Integer;
  var Handled: Boolean);
var
  vpos, hpos: Double;
  sz: Single;
begin
if not Handled then
  begin
  inherited;
  vpos := GetVScrollValue;
  hpos := GetHScrollValue;

  case OrientationMode of
    pomHorizontal: sz := DefaultColumnWidth;
    pomVertical: sz := DefaultRowHeight;
    else
      sz := 0;
  end;

  if WheelDelta > 0 then
    Scroll(hpos, vpos - sz)
  else
    Scroll(hpos, vpos + sz);

  Handled := True;
  end;
end;

Thank you for your investigation, we'll apply the changes accordingly.

Thank you. That is great, so I do not have to change it after every update.