DBPlanner.Template

Hello

Delphi 10 Seattle

In form.OnCreate the following is declared.


 DBPlanner1.DefaultItem.HTMLTemplate.Text := '<b><#STARTTIME></b><br><#NOTEFromTS_IOC><br>'; 

If an item is moved from one location to another on the DBPlanner1, the template can invoked via

procedure TformScheduleSimple.DBPlanner1ItemMove(Sender: TObject; Item: TPlannerItem; FromBegin, FromEnd, FromPos, ToBegin, ToEnd,
  ToPos: Integer);
begin
  Item.Update;
end;

The problem is that if an item is dragged from a PlannerWaitList I have not been able to find an event that allows the Template to be invoked  An example of what does not work is given below.

procedure TformScheduleSimple.DBPlanner1DragDropCell(Sender, Source: TObject; X, Y: Integer);
var
  tempPlannerItem: TPlannerItem;
begin
.......         
     tempPlannerItem := DBPlanner1.CellToItem(X,Y);
     tempPlannerItem.Update;
.........
end;

Suggestions??

John 

I assume from your description that you drag an item from the WaitList to the DBPlanner. In that case, you typically have code to insert the item in the DBPlanner to move the item from WaitList to DBPlanner and after it is moved, you should be able to update the moved item.


procedure TForm1.Planner1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
  if (source is TPlannerWaitList) then
  begin
    (source as TPlannerWaitList).MoveToPlanner(planner1,(source as TPlannerWaitlist).itemIndex,x,y);
    planner1.Items.Selected.Update;
  end;
end;