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

@ -25,9 +25,9 @@ object MainForm: TMainForm
Height = 532
Top = 48
Width = 780
ActivePage = TabContacts
ActivePage = TabSettings
Align = alClient
TabIndex = 2
TabIndex = 4
TabOrder = 0
object TabEvents: TTabSheet
Caption = 'Events'
@ -420,6 +420,17 @@ object MainForm: TMainForm
Style = csDropDownList
TabOrder = 2
end
object CbAllowInplaceEditing: TCheckBox
Left = 349
Height = 19
Top = 28
Width = 131
Caption = 'Allow inplace editing'
Checked = True
OnChange = CbAllowInplaceEditingChange
State = cbChecked
TabOrder = 3
end
end
end
object HeaderPanel: TPanel

View File

@ -15,6 +15,7 @@ TMAINFORM.TABSETTINGS.CAPTION=Settings
TMAINFORM.LBLLANGUAGE.CAPTION=Language
TMAINFORM.LBLTIMEFORMAT.CAPTION=Time format
TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week
TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing
TMAINFORM.TITLELBL.CAPTION=TitleLbl
TMAINFORM.MENUITEM1.CAPTION=File
TMAINFORM.MNUQUIT.CAPTION=Quit

View File

@ -22,6 +22,7 @@ type
CbGranularity: TComboBox;
CbTimeFormat: TComboBox;
CbFirstDayOfWeek: TComboBox;
CbAllowInplaceEditing: TCheckBox;
Img: TImage;
ImageList1: TImageList;
LblFirstDayOfWeek: TLabel;
@ -68,6 +69,7 @@ type
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject);
procedure CbAllowInplaceEditingChange(Sender: TObject);
procedure CbFirstDayOfWeekChange(Sender: TObject);
procedure CbGranularityChange(Sender: TObject);
procedure CbLanguagesChange(Sender: TObject);
@ -235,6 +237,14 @@ begin
VpResourceEditDialog1.AddNewResource;
end;
procedure TMainForm.CbAllowInplaceEditingChange(Sender: TObject);
begin
VpContactGrid1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;
VpDayView1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;
VpWeekView1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;
VpTaskList1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;
end;
procedure TMainForm.CbFirstDayOfWeekChange(Sender: TObject);
begin
VpWeekView1.WeekStartsOn := TVpDayType(CbFirstDayOfWeek.ItemIndex);
@ -428,6 +438,9 @@ begin
DaysTrackbar.Position := ini.ReadInteger('Settings', 'VisibleDays', DaysTrackbar.Position);
DaysTrackbarChange(nil);
CbAllowInplaceEditing.Checked := ini.ReadBool('Settings', 'AllowInplaceEditing', CbAllowInplaceEditing.Checked);
CbAllowInplaceEditingChange(nil);
finally
ini.Free;
end;
@ -457,6 +470,7 @@ begin
ini.WriteInteger('Settings', 'FirstDayOfWeek', ord(VpWeekView1.WeekStartsOn));
ini.WriteInteger('Settings', 'VisibleDays', VpDayView1.NumDays);
ini.WriteBool('Settings', 'AllTasks', VpTaskList1.DisplayOptions.ShowAll);
ini.WriteBool('Settings', 'AllowInplaceEditing', CbAllowInplaceEditing.Checked);
finally
ini.Free;
end;
@ -586,6 +600,7 @@ begin
LblTimeFormat.Left := CbTimeFormat.Left - 8 - GetLabelWidth(LblTimeFormat);
CbFirstDayOfWeek.Left := CbLanguages.Left;
LblFirstDayOfWeek.Left := CbFirstDayOfWeek.Left - 8 - GetLabelWidth(LblFirstDayOfWeek);
CbAllowInplaceEditing.Left := CbLanguages.Left + CbLanguages.Width + 32;
RbHideCompletedTasks.Left := RbAllTasks.Left + RbAllTasks.Width + 48;
// Next settings work correctly only for Windows.

View File

@ -145,6 +145,10 @@ msgstr "Neu"
msgid "Turbo Power VisualPlanIt Demo"
msgstr "Turbo Power VisualPlanIt Demo"
#: tmainform.cballowinplaceediting.caption
msgid "Allow inplace editing"
msgstr ""
#: tmainform.cbgranularity.text
msgid "30 Min"
msgstr "30 Min"
@ -237,3 +241,4 @@ msgstr "Aufgaben"
#: tmainform.titlelbl.caption
msgid "TitleLbl"
msgstr ""

View File

@ -134,6 +134,10 @@ msgstr ""
msgid "Turbo Power VisualPlanIt Demo"
msgstr ""
#: tmainform.cballowinplaceediting.caption
msgid "Allow inplace editing"
msgstr ""
#: tmainform.cbgranularity.text
msgid "30 Min"
msgstr ""

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