tvplanit: New property KBNavigation for TVpDayView and TVpMonthView to disable keyboard navigation, like in TVpMonthView

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8766 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-15 22:39:29 +00:00
parent 0ceb87ed80
commit a09c467161
4 changed files with 153 additions and 135 deletions

View File

@ -240,6 +240,7 @@ type
FHintMode: TVpHintMode;
FIconAttributes: TVpDayViewIconAttributes;
FIncludeWeekends: Boolean;
FKBNavigate: Boolean;
FLineColor: TColor;
FLineCount: Integer;
FMouseEvent: TVpEvent;
@ -518,6 +519,7 @@ type
property NumDays: Integer read FNumDays write SetNumDays default 1;
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
property HintMode: TVpHintMode read FHintMode write SetHintMode default hmPlannerHint;
property KBNavigation: Boolean read FKBNavigate write FKBNavigate default true;
property ShowNavButtons: Boolean read FShowNavButtons write SetShowNavButtons default true;
property FixedDate: Boolean read FFixedDate write FFixedDate default false;
property RowHeight: Integer read FCustomRowHeight write SetCustomRowHeight default 0;
@ -808,6 +810,7 @@ begin
FIncludeWeekends := True;
FAllowInplaceEdit := true;
FShowEventTimes := true;
FKBNavigate := true;
{ set up fonts and colors }
FHeadAttr.Font.Size := 10;
@ -2362,6 +2365,7 @@ procedure TVpDayView.KeyDown(var Key: Word; Shift: TShiftState);
var
PopupPoint : TPoint;
begin
if FKBNavigate then
case Key of
VK_UP:
ActiveRow := ActiveRow - 1;
@ -2415,7 +2419,11 @@ begin
if Assigned(FActiveEvent) then
dvEditInPlace(Self);
end;
end;
end
else
Key := 0;
inherited;
end;
{$IFNDEF LCL}

View File

@ -1495,7 +1495,11 @@ begin
PopupPoint := GetClientOrigin;
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
end;
end;
end
else
Key := 0;
inherited;
end;
procedure TVpMonthView.MouseDown(Button: TMouseButton; Shift: TShiftState;

View File

@ -117,8 +117,6 @@ begin
todayDate := Date();
DecodeDate(ADate, Y, M, D);
WriteLn(ATextRect.Top, ', ', ATextRect.Bottom, ', ', RealBottom);
if (ACol = 6) then
ATextRect.Right := ATextRect.Right + 8;

View File

@ -157,6 +157,7 @@ type
FHeadAttr: TVpWvHeadAttributes;
FHeaderMargin: Integer;
FHintMode: TVpHintMode;
FKBNavigate: Boolean;
FLineColor: TColor;
FMouseEvent: TVpEvent;
FLayout: TVpWeekviewLayout;
@ -353,6 +354,7 @@ type
property HeadAttributes: TVpWvHeadAttributes read FHeadAttr write FHeadAttr;
property HeaderMargin: Integer read FHeaderMargin write SetHeaderMargin default TEXT_MARGIN;
property HintMode: TVpHintMode read FHintMode write FHintMode default hmPlannerHint;
property KBNavigation: Boolean read FKBNavigate write FKBNavigate default true;
property LineColor: TColor read FLineColor write SetLineColor default DEFAULT_LINECOLOR;
property Layout: TVpWeekviewLayout read FLayout write SetLayout default wvlVertical;
property TextMargin: Integer read FTextMargin write SetTextMargin default 2;
@ -629,6 +631,7 @@ begin
wvClickTimer.OnTimer := wvEditInPlace;
wvCreatingEditor := false;
FDrawingStyle := ds3d;
FKBNavigate := true;
wvPainting := false;
FColor := DEFAULT_COLOR;
FLineColor := DEFAULT_LINECOLOR;
@ -1801,6 +1804,7 @@ procedure TVpWeekView.KeyDown(var Key: Word; Shift: TShiftState);
var
PopupPoint : TPoint;
begin
if FKBNavigate then
case Key of
VK_DELETE : DeleteActiveEvent(true);
VK_RIGHT : if Shift = [ssShift] then
@ -1883,7 +1887,11 @@ begin
PopupPoint := GetClientOrigin;
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
end;
end;
end
else
Key := 0;
inherited;
end;
procedure TVpWeekView.EndEdit(Sender: TObject);