tvplanit: Add new property "AllowInplaceEditing" for DayView, WeekView and TaskList.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4814 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-23 23:16:34 +00:00
parent 66bddaf5e0
commit 54dc447750
8 changed files with 80 additions and 26 deletions

View File

@@ -267,6 +267,7 @@ type
FWrapStyle: TVpDVWrapStyle;
FDotDotDotColor: TColor;
FShowEventTimes: Boolean;
FAllowInplaceEdit: Boolean;
{ event variables }
FOwnerDrawRowHead: TVpOwnerDrawRowEvent;
FOwnerDrawCells: TVpOwnerDrawRowEvent;
@@ -454,6 +455,7 @@ type
property TabOrder;
property Font;
property AllDayEventAttributes: TVpAllDayEventAttributes read FAllDayEventAttr write FAllDayEventAttr;
property AllowInplaceEditing: Boolean read FAllowInplaceEdit write FAllowInplaceEdit default true;
property DotDotDotColor: TColor read FDotDotDotColor write SetDotDotDotColor default clBlack;
property ShowEventTimes: Boolean read FShowEventTimes write SetShowEventTimes default true;
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True;
@@ -758,6 +760,7 @@ begin
FWrapStyle := wsIconFlow;
FDotDotDotColor := clBlack;
FIncludeWeekends := True;
FAllowInplaceEdit := true;
{ set up fonts and colors }
FHeadAttr.Font.Size := 10;
@@ -1925,29 +1928,32 @@ var
begin
if ReadOnly then
Exit;
AllowIt := true;
if not FAllowInplaceEdit then
Exit;
{ call the user defined BeforeEdit event }
AllowIt := true;
if Assigned(FBeforeEdit) then
FBeforeEdit(Self, FActiveEvent, AllowIt);
if not AllowIt then
exit;
if AllowIt then begin
{ create and spawn the in-place editor }
if dvInPlaceEditor = nil then begin
dvInPlaceEditor := TVpDvInPlaceEdit.Create(Self);
dvInPlaceEditor.Parent := self;
dvInPlaceEditor.OnExit := EndEdit;
end;
dvInPlaceEditor.SetBounds(
dvActiveIconRec.Right + FGutterWidth + TextMargin,
dvActiveEventRec.Top + TextMargin,
dvActiveEventRec.Right,
dvActiveEventRec.Bottom - 1
);
dvInPlaceEditor.Show;
dvInPlaceEditor.Text := FActiveEvent.Description;
Invalidate;
dvInPlaceEditor.SetFocus;
{ create and spawn the in-place editor }
if dvInPlaceEditor = nil then begin
dvInPlaceEditor := TVpDvInPlaceEdit.Create(Self);
dvInPlaceEditor.Parent := self;
dvInPlaceEditor.OnExit := EndEdit;
end;
dvInPlaceEditor.SetBounds(
dvActiveIconRec.Right + FGutterWidth + TextMargin,
dvActiveEventRec.Top + TextMargin,
dvActiveEventRec.Right,
dvActiveEventRec.Bottom - 1
);
dvInPlaceEditor.Show;
dvInPlaceEditor.Text := FActiveEvent.Description;
Invalidate;
dvInPlaceEditor.SetFocus;
end;
{=====}

View File

@@ -149,7 +149,8 @@ type
FDrawingStyle : TVpDrawingStyle;
FTaskID : Integer;
FDefaultPopup : TPopupMenu;
FShowIcon : Boolean;
FShowIcon : Boolean;
FAllowInplaceEdit : Boolean;
{ task variables }
FOwnerDrawTask : TVpOwnerDrawTask;
FBeforeEdit : TVpBeforeEditTask;
@@ -250,6 +251,8 @@ type
property TabOrder;
property ReadOnly;
property AllowInplaceEditing: Boolean
read FAllowInplaceEdit write FAllowInplaceEdit default true;
property DisplayOptions: TVpTaskDisplayOptions
read FDisplayOptions write FDisplayOptions;
property LineColor: TColor
@@ -262,8 +265,8 @@ type
read FDrawingStyle write SetDrawingStyle;
property Color: TColor
read FColor write SetColor;
property ShowIcon : Boolean read FShowIcon write SetShowIcon
default True;
property ShowIcon : Boolean
read FShowIcon write SetShowIcon default True;
property ShowResourceName: Boolean
read FShowResourceName write SetShowResourceName;
{ events }
@@ -536,6 +539,7 @@ begin
FScrollBars := ssVertical;
FTaskIndex := -1;
FShowIcon := True;
FAllowInplaceEdit := true;
SetLength(tlVisibleTaskArray, MaxVisibleTasks);
@@ -1506,6 +1510,9 @@ begin
if FActiveTask.Complete then
Exit;
if not FAllowInplaceEdit then
exit;
AllowIt := true;
VisTask := tlTaskIndexToVisibleTask (TaskIndex);
@@ -1528,7 +1535,7 @@ begin
tlInPlaceEditor.OnExit := EndEdit;
end;
tlInplaceEditor.Show;
tlInPlaceEditor.SetBounds(R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top); //Move(R, true);
tlInPlaceEditor.SetBounds(R.Left, R.Top, WidthOf(R), HeightOf(R));
tlInPlaceEditor.Text := FActiveTask.Description;
tlInPlaceEditor.Font.Assign(Font);
tlInPlaceEditor.SelectAll;

View File

@@ -137,6 +137,7 @@ type
FWeekStartsOn: TVpDayType;
FDefaultPopup: TPopupMenu;
FAllDayEventAttr: TVpAllDayEventAttributes;
FAllowInplaceEdit: Boolean;
{ event variables }
FBeforeEdit: TVpBeforeEditEvent;
FAfterEdit: TVpAfterEditEvent;
@@ -233,8 +234,8 @@ type
property VisibleLines: Integer read FVisibleLines;
published
property AllDayEventAttributes: TVpAllDayEventAttributes
read FAllDayEventAttr write FAllDayEventAttr;
property AllDayEventAttributes: TVpAllDayEventAttributes read FAllDayEventAttr write FAllDayEventAttr;
property AllowInplaceEditing: Boolean read FAllowInplaceEdit write FAllowInplaceEdit default true;
property Color: TColor read FColor write SetColor;
property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
property DayHeadAttributes: TVpDayHeadAttr read FDayHeadAttributes write FDayHeadAttributes;
@@ -425,6 +426,7 @@ begin
FTimeFormat := tf12Hour;
FDateLabelFormat := 'dddd, mmmm dd, yyyy';
FColumnWidth := 200;
FAllowInplaceEdit := true;
{ set up fonts and colors }
// FDayHeadAttributes.Font.Name := 'Tahoma';
@@ -1178,6 +1180,9 @@ var
AllowIt: Boolean;
begin
if ActiveEvent <> nil then begin
if not FAllowInplaceEdit then
exit;
AllowIt := true;
{ call the user defined BeforeEdit event }
if Assigned(FBeforeEdit) then