Planner SideBar Position problem

Good afternoon,

if the sidebar position change from spLeft to spTop in the planner "logic" change someting?

This question is due a strange planner work.



PL1 : TPlanner

DT   : TDateTime;

NT   : TTime;



General setting



With Pl1.Display do

begin

     DisplayUnit := 10;

     RowsPerHour := (60 div DisplayUnit);

     DisplayStart := 8 * RowsPerHour;

     DisplayEnd := 20 * RowsPerhour;

     ActiveStart := 8 * RowsPerHour;   // ((8 + 1) - 8) * RowsPerHour;

     ActiveEnd := ((19-8) * RowsPerHour) ;

end;



Now with sidebar.position=spLeft this code (where is 6 by runtime operation)

NT:=Pl1.CellToTime(0,Pl1.SelItemBegin);

gives as result NT=09:00



if change sidebar.position=slTop the same code (in the same condition, i select the cell according the hour 9 in the moring) i have

Pl1.SelItemBegin = 6 (correct ... is the same hour)

but

NT:=Pl1.CellToTime(0,Pl1.SelItemBegin);

gives as result 08:00



Is this normal or i miss something in the planner manual??



Thank's for attention



Daniele

The parameters of the function CellToTime() is X,Y,i.e. the cell X coordinate and Y coordinate and this changes when your orientation changes.

This code shows how to adapt for this:




procedure TForm1.Button1Click(Sender: TObject);
var
  NT: TTime;
begin
  if planner1.Sidebar.Position = spTop then
    NT := Planner1.CellToTime(planner1.SelItemBegin,0)
  else
    NT := Planner1.CellToTime(0,planner1.SelItemBegin);

  Caption:= timetostr(nt);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  rowsperhour: integer;
begin
  with planner1.Display do
  begin
     DisplayUnit := 10;
     RowsPerHour := (60 div DisplayUnit);
     DisplayStart := 8 * RowsPerHour;
     DisplayEnd := 20 * RowsPerhour;
     ActiveStart := 8 * RowsPerHour;   // ((8 + 1) - 8) * RowsPerHour;
     ActiveEnd := ((19-8) * RowsPerHour) ;
  end;

  //comment to set sidebar on top
//  planner1.Sidebar.Position := spTop;

  planner1.SelectCells(6,6,0);
end;

Thank's Bruno