SelPosition bug

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.

And another one that violates the idea of Sidebar.Position  = spTop is PosToDay that adds the ItemPosition to EncodeDate.

And number 3:

from TPlannerItem.SetItemStartTime

        if not FPlanner.IsDBAware then
        begin
          di := Trunc(Int(EncodeDate(FPlanner.Mode.Year, FPlanner.Mode.Month, FPlanner.Mode.Day)));
          dn := Trunc(Int(value));
          if (dn > 0) then
            FItemPos := dn - di;
        end;

 

No checking of the Sidebar.Position, so I have to code defensively...

When Planner.Mode.PlannerType = plDay and Planner.Mode.Day / Month / Year is different from zero, the Planner is supposed to work as a multiday Planner, i.e. each position represents a day.  If you want to use the non DB-aware Planner as multiresource Planner, leave Planner.Mode.Day / Month / Year  = 0


What does this have to do with the choice of having the Days/Times on the x-axis instead of the y-axis that all the sources rely on?