TvPlanIt: Fix double-click on event in hour mode.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8944 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-09 22:46:32 +00:00
parent 9a8edcf7f5
commit d4fd4f420e
3 changed files with 21 additions and 7 deletions

View File

@ -13,3 +13,4 @@ Version=v105
1842424188={StartTime:2022/08/02 08:00:00}|{EndTime:2022/08/04 16:00:00}|{ResourceID:1178568021}|{Description:Phase 5}|{Category:1}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0} 1842424188={StartTime:2022/08/02 08:00:00}|{EndTime:2022/08/04 16:00:00}|{ResourceID:1178568021}|{Description:Phase 5}|{Category:1}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
1819459250={StartTime:2022/08/03}|{EndTime:2022/08/11}|{ResourceID:1178568021}|{Description:Phase 6}|{Category:0}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0} 1819459250={StartTime:2022/08/03}|{EndTime:2022/08/11}|{ResourceID:1178568021}|{Description:Phase 6}|{Category:0}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
1339092840={StartTime:2022/08/10}|{EndTime:2022/08/16}|{ResourceID:1178568021}|{Description:Phase 7}|{Category:3}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0} 1339092840={StartTime:2022/08/10}|{EndTime:2022/08/16}|{ResourceID:1178568021}|{Description:Phase 7}|{Category:3}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
1170127712={StartTime:2023/10/10 08:00:00}|{EndTime:2023/10/10 16:00:00}|{ResourceID:1178568021}|{Description:TEST ABC}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}

View File

@ -64,11 +64,6 @@
<Debugging> <Debugging>
<DebugInfoType Value="dsDwarf2Set"/> <DebugInfoType Value="dsDwarf2Set"/>
</Debugging> </Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking> </Linking>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>

View File

@ -4,7 +4,7 @@ unit VpGanttView;
{$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined} {$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
interface interface
uses uses lazloggerbase,
LCLType, LCLIntf, LMessages, LCLType, LCLIntf, LMessages,
Classes, SysUtils, Graphics, Types, Controls, StdCtrls, Menus, Forms, Classes, SysUtils, Graphics, Types, Controls, StdCtrls, Menus, Forms,
VpConst, VpMisc, VpBase, VpBaseDS, VpData; VpConst, VpMisc, VpBase, VpBaseDS, VpData;
@ -1197,10 +1197,27 @@ end;
function TVpGanttView.GetDateTimeAtCoord(X: Integer): TDateTime; function TVpGanttView.GetDateTimeAtCoord(X: Integer): TDateTime;
var var
c: Integer; c: Integer;
dayIdx: Integer;
dayPos: Integer;
dayWidth: Integer;
timePart: TTime;
begin begin
c := GetColAtCoord(X); c := GetColAtCoord(X);
if (c >= 0) and (c < ColCount) then if (c >= 0) and (c < ColCount) then
Result := GetDateOfCol(c) begin
Result := GetDateOfCol(c);
X := X - FFixedColWidth;
dayWidth := CalcDaysWidth(1);
if HourMode then
begin
dayIdx := ColToDateIndex(c);
dayPos := FDayRecords[dayIdx].Rect.Left - FFixedColWidth;
dec(dayPos, FLeftCol * FColWidth);
timePart := (((X - dayPos) / dayWidth) * HoursPerDay + ord(FStartHour)) / 24;
end else
timePart := frac(X / dayWidth);
Result := Result + timePart;
end
else else
Result := NO_DATE; Result := NO_DATE;
end; end;
@ -1706,6 +1723,7 @@ begin
dt := GetDateTimeAtCoord(X); dt := GetDateTimeAtCoord(X);
if dt <> NO_DATE then if dt <> NO_DATE then
SetActiveDate(dt); SetActiveDate(dt);
Invalidate; Invalidate;
end; end;