diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index 9b1ef685e..e2414a82b 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -1167,7 +1167,7 @@ begin begin FEndDate := trunc(ADate); FColCount := GetNumDays; - SetLeftCol(MaxInt); + SetLeftCol(FColCount - 1 - FVisibleCols); end else if ADate < FStartDate + FLeftCol then SetLeftCol(trunc(ADate) - trunc(FStartDate)) diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index 3c40c10b1..e8959274e 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -1391,24 +1391,27 @@ var EndTime: TDateTime; begin if ReadOnly or (not CheckCreateResource) or - (not Assigned(DataStore) ) or (not Assigned(DataStore.Resource)) + (not Assigned(DataStore)) or (not Assigned(DataStore.Resource)) then Exit; - StartTime := NextFullHour(Now()); { Default start time: next full hour } + // Default start time: next full hour on the active day. // Be careful: By taking the next full hour we may advance to the next day - // here which is very confusing to the user who had clicked on the - // previous day. In this case we go back by one hour (--> 23:00) + // here which is very confusing to the user who had selected the previous day. + // In this case we go back by one hour (--> 23:00) + StartTime := NextFullHour(FActiveDate + Time()); if Trunc(StartTime) <> FActiveDate then StartTime := StartTime - OneHour; - EndTime := StartTime + 30 / MinutesInDay; { StartTime + 30 minutes } + + // Default end time: Start time + 30 minutes + EndTime := StartTime + 30 * OneMinute; ActiveEvent := DataStore.Resource.Schedule.AddEvent( DataStore.GetNextID('Events'), StartTime, EndTime ); - { edit this new event } + // Edit this new event wvSpawnEventEditDialog(True); end;