HalfdayPeriod Plannner with DayPlanner

Good afternoon,

I've a TPlanner defined as "Halfdayperiod".
At the bottom of window I've another planner defined "Day" and I show only one single Day.
For each planner I've some columns.

When i click in the Cell or on an Item in the "HaldDayPeriod" i want to show all Items included in the selected day to the "Day Planner".

I this it was simple (copy of items from halfdayplanner to dayplanner) but is not too simple.

Some help?

thank you

You'd need to loop through your items in the halfdayperiod Planner and for each item on the matching day, create an item for the Planner in day mode and copy its properties. There is not an easy other way to "transfer" items otherwise.

Thank you.
I do this but is not clear what are the properties that I must use to do this.

I try to put by code:

Legenda:
PlannerHT is my HalfDay Planner
PlannerD is my DayPlanner

-----
by now, on "SelectCell" event i call my procedure:

procedure TF_Main.PlannerHTPlannerSelectCell(Sender: TObject; Index,
  Pos: Integer; var CanSelect: Boolean);
begin
  if Visible then RenderD(Index, Pos);
end;

my Procedure RenderD try to copy all Items available in the selected day:


procedure TF_Main.RenderD(const aIndex, aPos: integer);
var vBeginPos, vI: integer;
    vItem, vNewItem: TPlannerItem;
    vFromTime, vToTime: TDateTime;
    vHour, vMin, vSec, vMSec: word;
    vYear, vMonth, vDay: word;
begin
  try
    PlannerD.Items.BeginUpdate;
    PlannerD.Items.ClearAll;
    vItem := PlannerHT.Items.Selected;
    if Assigned(vItem) then
    begin
      vBeginPos := vItem.ItemBegin;
      vFromTime := vItem.ItemStartTime;
      vToTime := vItem.ItemEndTime;
    end
    else
    begin
      vBeginPos := aIndex;
      PlannerHT.CellToAbsTime(vBeginPos, vFromTime, vToTime);
    end;
    DecodeDate(vFromTime, vYear, vMonth, vDay);
    DecodeTime(vFromTime, vHour, vMin, vSec, vMSec);
    DecodeTime(vToTime, vHour, vMin, vSec, vMSec);
    if vHour >= 12 then vBeginPos := vBeginPos-1;

    PlannerD.Mode.Date := vFromTime;
    PlannerD.Mode.Day := vDay;
    PlannerD.Mode.Month := vMonth;
    PlannerD.Mode.Year := vYear;
    PlannerD.Mode.PeriodStartDate := vFromTime;
    PlannerD.Mode.PeriodEndDate := vFromTime;

    for vI := 0 to PlannerHT.Items.Count-1 do
    begin
      vItem := PlannerHT.Items[vI];
      if (DateOf(vItem.ItemRealStartTime) <= DateOf(vFromTime)) and
         (DateOf(vItem.ItemRealEndTime) >= DateOf(vFromTime)) then
      begin
          vNewItem := PlannerD.Items.Add;
          vNewItem.Assign(vItem);
      end;
    end;
  finally
    PlannerD.Items.EndUpdate;
  end;
end;


I'm sure there are errors on assign items but i don't understand which properites I must copy.

thank you for your support

Please start by using the PlannerItem.ItemStartTime / PlannerItem.ItemEndTime properties.
When this is correct, you should at least start seeing empty but correct copied items. Inspect the start & end time you get in your loop. When this is working as expected, you can continue copying other PlannerItem properties that are of interest to you.

Solved usinf ItemStartTime and ItemEndTime but I must associate as ItemObject an item that store original StartDateTime and EndDateTIme.
When i create a new item i do this:

...ItemStartTime := Tmycustomobj(myoriginalitem.itemobject).StartDateTime