TPlanner, Switch date period, no Update

Hello together,


I have a problem with the TPlanner component.

I have dropped the component and a button on a form, I am using the planner in "plDayPeriod" mode. The left axis is showing (positions) the employees naems, the Display (sidebar)  shows the date of the the days.


When I click the button, I would like to thange the calendar view forward for one month. The components variables "PeriodStartDay" etc. are filled correct, that means the component has the values from the run before.


The view also changes, but when I click into the planner (PlannerMAZeitenItemLeftClick) the selected cell/column  doesn?t show the coresponding date, which I want to show into some edit fields. That could mean that somewhere an information is missing, to display the coresponding date.




What am I doing wrong, what is missing?



Does somebody have an idea. I would be pleased for a hint!



The code:

procedure TForm1.ButtonPlanerArbeitszeiteMonatVorClick(Sender: TObject);

var jahr, monat, tag : word;

    erg : integer;



begin

  //ButtonZeitplanerSpeichernClick(self);



  jahr := PlannerMAZeiten.Mode.PeriodStartYear;

  monat := PlannerMAZeiten.Mode.PeriodStartMonth;

  tag := PlannerMAZeiten.Mode.PeriodStartDay;



  // Start

  monat := monat + 1;

  if monat = 13 then

  begin

    monat := 1;

    jahr := jahr + 1;

  end;



  PlannerMAZeiten.Mode.PeriodStartDay := tag;

  PlannerMAZeiten.Mode.PeriodStartMonth := monat;

  PlannerMAZeiten.Mode.PeriodStartYear := jahr;



  PlannerMAZeiten.Mode.Year := jahr;

  PlannerMAZeiten.Mode.Month := monat;

  PlannerMAZeiten.Mode.Day := tag;



  PlannerMAZeiten.Mode.TimeLineNVUBegin := 0;

  PlannerMAZeiten.Mode.TimeLineNVUEnd := 0;

  PlannerMAZeiten.Mode.TimeLineStart := EncodeDate(jahr, monat, tag);



  // Ende

  erg := monat + 1;

  if (erg > 12) then

  begin

    monat := erg - 12;

    jahr := jahr + 1;

  end

  else

    monat := monat + 1;

 

  PlannerMAZeiten.Mode.PeriodEndDay := tag;

  PlannerMAZeiten.Mode.PeriodEndMonth := monat;

  PlannerMAZeiten.Mode.PeriodEndYear := jahr;



  //ButtonZeitplannerLadenClick(self);

end;



procedure TForm1.PlannerMAZeitenItemLeftClick(Sender: TObject; Item: TPlannerItem);

var datum : tDateTime;

    position : integer;



begin

  datum := item.ItemStartTime;

  position := item.ItemPos;



  ComboBoxPlanungMitarbeiter.ItemIndex := Position;



  selected_date := DatetimeToStr(datum);

  tmp_date := datum;

  start_date := datum;

  end_date := datum;



  EditZeitVon.Text := selected_date;

  EditZeitBis.Text := selected_date;

end;

What I see from your code is that you change the start & end time of the period but I cannot see you reload the items (corresponding with the new period you selected).

When you just change the timeaxis and leave the items unchanged, the item's ItemStartTime / ItemEndTime will not change (unless you'd move the items).
So, when you change the time-axis, you'd need to reload the items to have the correct corresponding items in the Planner or have items' position updated.