You've already forked lazarus-ccr
tvplanit: Fix double-click on monthview finding events in wrong month.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8535 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -94,39 +94,6 @@ type
|
|||||||
property Color default WEEKEND_COLOR;
|
property Color default WEEKEND_COLOR;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*
|
|
||||||
TVpMvHeadAttr = class(TPersistent)
|
|
||||||
protected{ private }
|
|
||||||
FOwner: TVpMonthView;
|
|
||||||
FColor: TColor;
|
|
||||||
FFont: TVpFont;
|
|
||||||
procedure SetColor(const Value: TColor);
|
|
||||||
procedure SetFont(Value: TVpFont);
|
|
||||||
public
|
|
||||||
constructor Create(AOwner: TVpMonthView);
|
|
||||||
destructor Destroy; override;
|
|
||||||
property Owner: TVpMonthView read FOwner;
|
|
||||||
published
|
|
||||||
property Font: TVpFont read FFont write SetFont;
|
|
||||||
property Color: TColor read FColor write SetColor;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TVpDayHeadAttr = class(TPersistent)
|
|
||||||
protected{private}
|
|
||||||
FMonthView: TVpMonthView;
|
|
||||||
FFont: TVpFont;
|
|
||||||
FColor: TColor;
|
|
||||||
procedure SetColor(Value: TColor);
|
|
||||||
procedure SetFont(Value: TVpFont);
|
|
||||||
public
|
|
||||||
constructor Create(AOwner: TVpMonthView);
|
|
||||||
destructor Destroy; override;
|
|
||||||
property MonthView: TVpMonthView read FMonthView;
|
|
||||||
published
|
|
||||||
property Color: TColor read FColor write SetColor;
|
|
||||||
property Font: TVpFont read FFont write SetFont;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
TVpMvTodayAttr = class(TVpMonthViewAttr)
|
TVpMvTodayAttr = class(TVpMonthViewAttr)
|
||||||
private
|
private
|
||||||
FBorderPen: TPen;
|
FBorderPen: TPen;
|
||||||
@ -1385,40 +1352,50 @@ end;
|
|||||||
function TVpMonthView.SelectEventAtCoord(Point: TPoint): Boolean;
|
function TVpMonthView.SelectEventAtCoord(Point: TPoint): Boolean;
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
y1, m1, d1: Word;
|
||||||
|
y2, m2, d2: Word;
|
||||||
begin
|
begin
|
||||||
result := false;
|
Result := false;
|
||||||
|
|
||||||
|
DecodeDate(FDate, y1, m1, d1);
|
||||||
I := 0;
|
I := 0;
|
||||||
while I < Length(mvEventArray) do begin
|
while I < Length(mvEventArray) do begin
|
||||||
if mvEventArray[I].Event = nil then begin
|
if mvEventArray[I].Event = nil then begin
|
||||||
Inc(I);
|
Inc(I);
|
||||||
Break;
|
Break;
|
||||||
end else begin
|
end else begin
|
||||||
if (Point.X > mvEventArray[I].Rec.Left)
|
if PtInRect(mvEventArray[I].Rec, Point) then
|
||||||
and (Point.X < mvEventArray[I].Rec.Right)
|
begin
|
||||||
and (Point.Y > mvEventArray[I].Rec.Top)
|
DecodeDate(TVpEvent(mvEventArray[I].Event).StartTime, y2, m2, d2);
|
||||||
and (Point.Y < mvEventArray[I].Rec.Bottom) then begin
|
if (y1 = y2) and (m1 = m2) then
|
||||||
result := true;
|
begin
|
||||||
Break;
|
mvActiveEvent := TVpEvent(mvEventArray[I].Event);
|
||||||
end else
|
mvActiveEventRec := mvEventArray[I].Rec;
|
||||||
Inc(I);
|
Result := true;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Inc(I);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if result then begin
|
|
||||||
mvActiveEvent := TVpEvent(mvEventArray[I].Event);
|
|
||||||
mvActiveEventRec := mvEventArray[I].Rec;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpMonthView.mvSetDateByCoord(APoint: TPoint);
|
procedure TVpMonthView.mvSetDateByCoord(APoint: TPoint);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
d1, m1, y1: Word;
|
||||||
|
d2, m2, y2: Word;
|
||||||
begin
|
begin
|
||||||
for I := 0 to pred(Length(mvMonthdayArray)) do
|
DecodeDate(FDate, y1, m1, d1);
|
||||||
if PointInRect(APoint, mvMonthdayArray[I].Rec) then
|
for I := 0 to pred(Length(mvMonthDayArray)) do
|
||||||
|
if PointInRect(APoint, mvMonthDayArray[I].Rec) then
|
||||||
begin
|
begin
|
||||||
Date := mvMonthdayArray[I].Date;
|
DecodeDate(mvMonthDayArray[I].Date, y2, m2, d2);
|
||||||
break;
|
if (y1 = y2) and (m1 = m2) then
|
||||||
|
begin
|
||||||
|
Date := mvMonthdayArray[I].Date;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user