Problem with setting date on planner item

Hi,

I try to create a new item by double clicking on the planner, but the date in my editor is not set correct (time is ok). First some code:


procedure Tmain.plannerPlannerDblClick(Sender: TObject; Position, FromSel,
  FromSelPrecise, ToSel, ToSelPrecise: Integer);
var
st,et, sd : TDateTime;
o : TPlannerItem;
begin
  Planner.CellToAbsTime(FromSel,st,et);
  o := planner.CreateItem;
  o.ItemStartTime := st;
  o.ItemRealStartTime := st;
  o.ItemEndTime   := IncMinute(st,30);
  o.ItemRealEndTime := IncMinute(st,30);
  o.Editor.Edit(planner,o);
end;


and the assignfromplanneritem in my editor looks like:


procedure Tdateedit.AssignFromPlannerItem(PlannerItem: TPlannerItem);
begin
  edSubject.Text := PlannerItem.CaptionText;
  edMemo.Lines   := PlannerItem.Text;
  if PlannerItem.RealTime then
  begin
    PlanDate.Date  := PlannerItem.ItemRealStartTime;
    StartTime.Time := PlannerItem.ItemRealStartTime;
    EndTime.Time   := PlannerItem.ItemRealEndTime;
  end
  else
  begin
    PlanDate.Date  := PlannerItem.ItemStartTime;
    StartTime.Time := PlannerItem.ItemStartTime;
    EndTime.Time   := PlannerItem.ItemEndTime;
  end;
end;


What's wrong here?

Best regards ...


  1. Are you using the latest version of the Planner?
    2) In what mode is your Planner?
    3) Is Planner.CellToAbsTime(FromSel,st,et); returning the correct date in st/et?

Hi,

1) I use not the latest version (2.5.8.2)
2) Which Attribut do you mean? Type is set to plDay.
3) Planner.CellToAbsTime(FromSel,st,et); Returns the correct date!!!

Best regards ...

Could you please first test this with the latest version as requested

at http://www.tmssoftware.com/site/support.asp
We're unaware of issues with this in the latest version of the component.

Hi,

I've installed the latest version. The problem is the same.

Best regards ...

Hi,

I tried a little bit more. The date isn't set correct here:


procedure Tmain.plannerPlannerDblClick(Sender: TObject; Position, FromSel, FromSelPrecise, ToSel, ToSelPrecise: Integer);
var
st,et : TDateTime;
o : TPlannerItem;
begin
  Planner.CellToAbsTime(FromSel,st,et);
  o := planner.CreateItem;
  ShowMessage(DateTimeToStr(st)); // HERE THE DATE IS CORRECT
  o.ItemStartTime := st;
  o.ItemRealStartTime := st;
  o.ItemEndTime   := IncMinute(st,30);
  o.ItemRealEndTime := IncMinute(st,30);
  ShowMessage(DateTimeToStr(o.ItemStartTime)); // HERE THE DATE IS NOT CORRECT
  o.Editor.Edit(planner,o);
end;


I use the latest version and D2010. Can anyone help?

Best regards ...

To handle this in an efficient way, can you please contact by email and send a sample source project with which we can reproduce the problem so we know all property settings that are involved.

Try this way

  var division:integer;
  var SetTime:TTime;


division:=60 div Plan.Display.DisplayUnit;

SetTime:=StrToTime(IntToStr(FromSel div division)+':'+floattostr(((FromSel / division)-(FromSel div division))*60));