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 begin
FEndDate := trunc(ADate); FEndDate := trunc(ADate);
FColCount := GetNumDays; FColCount := GetNumDays;
SetLeftCol(MaxInt); SetLeftCol(FColCount - 1 - FVisibleCols);
end else end else
if ADate < FStartDate + FLeftCol then if ADate < FStartDate + FLeftCol then
SetLeftCol(trunc(ADate) - trunc(FStartDate)) SetLeftCol(trunc(ADate) - trunc(FStartDate))

View File

@ -1395,20 +1395,23 @@ begin
then then
Exit; 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 // 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 // here which is very confusing to the user who had selected the previous day.
// previous day. In this case we go back by one hour (--> 23:00) // In this case we go back by one hour (--> 23:00)
StartTime := NextFullHour(FActiveDate + Time());
if Trunc(StartTime) <> FActiveDate then if Trunc(StartTime) <> FActiveDate then
StartTime := StartTime - OneHour; 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( ActiveEvent := DataStore.Resource.Schedule.AddEvent(
DataStore.GetNextID('Events'), DataStore.GetNextID('Events'),
StartTime, StartTime,
EndTime EndTime
); );
{ edit this new event } // Edit this new event
wvSpawnEventEditDialog(True); wvSpawnEventEditDialog(True);
end; end;