tvplanit: Fix date of new event when created from WeekView (was on current day rather than selected day).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8431 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-31 20:47:45 +00:00
parent 398734211f
commit 7ac4c2769e
2 changed files with 10 additions and 7 deletions

View File

@ -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))

View File

@ -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;