When /dropping an item from a TPlanner onto a TPlannerWaitList, what event is triggered, or what are the correct mechanics, such that within the waitlist I can access & update the newly dropped item?
When dropping an item from the waitlist onto a planner, WaitList.MoveToPlanner(Planner, WaitList.ItemIndex, x, y) returns the new planner item such that I can update the start & end times. However, there doesn't seem to be a similar method when an item is dropped onto the waitlist.
Thanks
The PlannerWaitList has two methods:
PlannerWaitList.MoveFromPlanner()
PlannerWaitList.MoveToPlanner()
these are the methods that cover moving items from and to the Planner and these work in the same way for both directions.
Thanks, Bruno, for your reply.
I'm admittedly still unsure... when dropping onto TPlanner I can do somethign like this:
procedure TForm1.Planner1DragDrop(Sender, Source: TObject; X, Y: Integer);
Var
itemID : Int32;
newPlannerItem : TPlannerItem;
WaitList : TPlannerWaitList;
Planner : TPlanner;
begin
Planner := (Sender as TPlanner);
WaitList := (Source as TPlannerWaitlist);
if (Source is TPlannerWaitList) then
begin
// get the existing itemID
itemID := WaitList.Items.Items[WaitList.ItemIndex].ID;
newPlannerItem := WaitList.MoveToPlanner(Planner, WaitList.ItemIndex, x, y);
newPlannerItem.ID := itemID;
UpdatePlannerItem(newPlannerItem);
end;
end;
However, when dropping an item on the waitlist, WaitList.MoveFromPlanner() is a procedure as such doesn't return a value so not sure how to 'access' the newly dropped item on the waitlist.
procedure TForm1.WaitListDragDrop(Sender, Source: TObject; X, Y: Integer);
Var
itemID : Int32;
newPlannerItem : TPlannerItem;
WaitList : TPlannerWaitList;
Planner : TPlanner;
begin
WaitList := (Sender as TPlannerWaitlist);
Planner := (Source as TPlanner);
if (Source is TPlanner) then
begin
WaitList.MoveFromPlanner(Planner, [Item???]);
end;
end;
Thanks!
Chris
It is expected to be the selected item in the Planner,i.e. planner.Items.Selected: TPlannerItem
Thanks. I did try that but must have had something wrong.
I'll give it another try.
Thanks again!