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

View File

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

View File

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

View File

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