You've already forked lazarus-ccr
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:
@ -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,89 +1804,94 @@ procedure TVpWeekView.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
PopupPoint : TPoint;
|
||||
begin
|
||||
case Key of
|
||||
VK_DELETE : DeleteActiveEvent(true);
|
||||
VK_RIGHT : if Shift = [ssShift] then
|
||||
PopupNextWeek (Self)
|
||||
else if (Shift = [ssCtrl]) then
|
||||
PopupNextMonth (Self)
|
||||
else if (Shift = [ssShift, ssCtrl]) then
|
||||
PopupNextYear (Self)
|
||||
else if Shift = [] then begin
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 4;
|
||||
2 : FActiveDate := FActiveDate + 3;
|
||||
3 : FActiveDate := FActiveDate + 3;
|
||||
4 : FActiveDate := FActiveDate + 3;
|
||||
5 : FActiveDate := FActiveDate - 3;
|
||||
6 : FActiveDate := FActiveDate - 3;
|
||||
7 : FActiveDate := FActiveDate - 3;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_LEFT : if Shift = [ssShift] then
|
||||
PopupPrevWeek (Self)
|
||||
else if (Shift = [ssCtrl]) then
|
||||
PopupPrevMonth (Self)
|
||||
else if (Shift = [ssShift, ssCtrl]) then
|
||||
PopupPrevYear (Self)
|
||||
else if Shift = [] then begin
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 4;
|
||||
2 : FActiveDate := FActiveDate + 3;
|
||||
3 : FActiveDate := FActiveDate + 3;
|
||||
4 : FActiveDate := FActiveDate + 3;
|
||||
5 : FActiveDate := FActiveDate - 3;
|
||||
6 : FActiveDate := FActiveDate - 3;
|
||||
7 : FActiveDate := FActiveDate - 3;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_UP : begin
|
||||
if Shift = [] then
|
||||
if FKBNavigate then
|
||||
case Key of
|
||||
VK_DELETE : DeleteActiveEvent(true);
|
||||
VK_RIGHT : if Shift = [ssShift] then
|
||||
PopupNextWeek (Self)
|
||||
else if (Shift = [ssCtrl]) then
|
||||
PopupNextMonth (Self)
|
||||
else if (Shift = [ssShift, ssCtrl]) then
|
||||
PopupNextYear (Self)
|
||||
else if Shift = [] then begin
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 1;
|
||||
2 : FActiveDate := FActiveDate + 2;
|
||||
3 : FActiveDate := FActiveDate - 1;
|
||||
4 : FActiveDate := FActiveDate - 1;
|
||||
5 : FActiveDate := FActiveDate + 3;
|
||||
6 : FActiveDate := FActiveDate - 1;
|
||||
7 : FActiveDate := FActiveDate - 1;
|
||||
1 : FActiveDate := FActiveDate - 4;
|
||||
2 : FActiveDate := FActiveDate + 3;
|
||||
3 : FActiveDate := FActiveDate + 3;
|
||||
4 : FActiveDate := FActiveDate + 3;
|
||||
5 : FActiveDate := FActiveDate - 3;
|
||||
6 : FActiveDate := FActiveDate - 3;
|
||||
7 : FActiveDate := FActiveDate - 3;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_DOWN : begin
|
||||
if Shift = [] then
|
||||
Invalidate;
|
||||
end;
|
||||
VK_LEFT : if Shift = [ssShift] then
|
||||
PopupPrevWeek (Self)
|
||||
else if (Shift = [ssCtrl]) then
|
||||
PopupPrevMonth (Self)
|
||||
else if (Shift = [ssShift, ssCtrl]) then
|
||||
PopupPrevYear (Self)
|
||||
else if Shift = [] then begin
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 3;
|
||||
2 : FActiveDate := FActiveDate + 1;
|
||||
3 : FActiveDate := FActiveDate + 1;
|
||||
4 : FActiveDate := FActiveDate - 2;
|
||||
5 : FActiveDate := FActiveDate + 1;
|
||||
6 : FActiveDate := FActiveDate + 1;
|
||||
7 : FActiveDate := FActiveDate + 1;
|
||||
1 : FActiveDate := FActiveDate - 4;
|
||||
2 : FActiveDate := FActiveDate + 3;
|
||||
3 : FActiveDate := FActiveDate + 3;
|
||||
4 : FActiveDate := FActiveDate + 3;
|
||||
5 : FActiveDate := FActiveDate - 3;
|
||||
6 : FActiveDate := FActiveDate - 3;
|
||||
7 : FActiveDate := FActiveDate - 3;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_INSERT : PopupAddEvent(Self);
|
||||
{$IFNDEF LCL}
|
||||
VK_TAB :
|
||||
if ssShift in Shift then
|
||||
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, False))
|
||||
else
|
||||
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, True));
|
||||
{$ENDIF}
|
||||
VK_F10:
|
||||
if (ssShift in Shift) and not Assigned(PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
VK_APPS:
|
||||
if not Assigned (PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_UP : begin
|
||||
if Shift = [] then
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 1;
|
||||
2 : FActiveDate := FActiveDate + 2;
|
||||
3 : FActiveDate := FActiveDate - 1;
|
||||
4 : FActiveDate := FActiveDate - 1;
|
||||
5 : FActiveDate := FActiveDate + 3;
|
||||
6 : FActiveDate := FActiveDate - 1;
|
||||
7 : FActiveDate := FActiveDate - 1;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_DOWN : begin
|
||||
if Shift = [] then
|
||||
case DayOfWeek (FActiveDate) of
|
||||
1 : FActiveDate := FActiveDate - 3;
|
||||
2 : FActiveDate := FActiveDate + 1;
|
||||
3 : FActiveDate := FActiveDate + 1;
|
||||
4 : FActiveDate := FActiveDate - 2;
|
||||
5 : FActiveDate := FActiveDate + 1;
|
||||
6 : FActiveDate := FActiveDate + 1;
|
||||
7 : FActiveDate := FActiveDate + 1;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
VK_INSERT : PopupAddEvent(Self);
|
||||
{$IFNDEF LCL}
|
||||
VK_TAB :
|
||||
if ssShift in Shift then
|
||||
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, False))
|
||||
else
|
||||
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, True));
|
||||
{$ENDIF}
|
||||
VK_F10:
|
||||
if (ssShift in Shift) and not Assigned(PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
VK_APPS:
|
||||
if not Assigned (PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Key := 0;
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.EndEdit(Sender: TObject);
|
||||
|
Reference in New Issue
Block a user