I added a TPlanner to a form.
Set Planner.Mode.Day, Month, Year to the respective components of a date. For example 20..8..2013 (today that is)
SetPlanner.Mode.PlannerType to plDay
Set Planner.Sidebar.Position to spTop.
Fill the y-axis with stuff people can rent for a period, for example item1, item2, item3.
Select a bunch of cells in the grid and create an item from it.
Part of the code:
var
Start, Eind, Dummy: TDateTime;
begin Planner.CellToAbsTime(Planner.SelItemBegin, Start, Dummy);
Planner.CellToAbsTime(Pred(Planner.SelItemEnd), Dummy, Eind); end.
Obviously you do something with the TDateTime variables.
Onto the bug... Depending on the item selected the Date part of the variables will be wrong (remember that the Sidebar is positioned on top, not left).
---
function TCustomPlanner.GetSelPosition: Integer; begin
case FSidebar.Position of spLeft, spLeftRight:
Result := FGrid.Selection.Left - 1;
spRight:
Result := FGrid.Selection.Left;
spTop:
Result := FGrid.Selection.Top - 1;
else
Result := FGrid.Selection.Left - 1;
end; end;
---
As the position is spTop it will evaluate the Result to the Selection.Top - 1. Ergo the item I am renting, not the date.
Oops.