tvplanit: Introduce a datamodule in the fulldemo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5122 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-02 16:45:47 +00:00
parent d582c8663f
commit aef96e2519
9 changed files with 67 additions and 102 deletions

View File

@ -39,7 +39,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item3> </Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="4"> <Units Count="5">
<Unit0> <Unit0>
<Filename Value="demo.lpr"/> <Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -63,6 +63,13 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
</Unit3> </Unit3>
<Unit4>
<Filename Value="demodatamodule.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="DemoDM"/>
<ResourceBaseClass Value="DataModule"/>
<UnitName Value="demoDatamodule"/>
</Unit4>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -8,13 +8,14 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator, Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator,
printer4lazarus; printer4lazarus, demoDatamodule;
{$R *.res} {$R *.res}
begin begin
RequireDerivedFormResource := True; RequireDerivedFormResource := True;
Application.Initialize; Application.Initialize;
Application.CreateForm(TDemoDM, DemoDM);
Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TMainForm, MainForm);
Application.Run; Application.Run;
end. end.

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm object MainForm: TMainForm
Left = 301 Left = 368
Height = 596 Height = 596
Top = 177 Top = 134
Width = 959 Width = 959
Caption = 'Turbo Power VisualPlanIt Demo' Caption = 'Turbo Power VisualPlanIt Demo'
ClientHeight = 576 ClientHeight = 576
@ -9,7 +9,7 @@ object MainForm: TMainForm
Menu = MainMenu1 Menu = MainMenu1
OnCloseQuery = FormCloseQuery OnCloseQuery = FormCloseQuery
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.6.0.4' LCLVersion = '1.7'
object Panel1: TPanel object Panel1: TPanel
Left = 125 Left = 125
Height = 576 Height = 576
@ -77,7 +77,6 @@ object MainForm: TMainForm
Height = 197 Height = 197
Top = 331 Top = 331
Width = 333 Width = 333
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Align = alBottom Align = alBottom
@ -118,7 +117,6 @@ object MainForm: TMainForm
Height = 284 Height = 284
Top = 42 Top = 42
Width = 333 Width = 333
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Font.Height = -12 Font.Height = -12
@ -273,7 +271,6 @@ object MainForm: TMainForm
Height = 528 Height = 528
Top = 0 Top = 0
Width = 496 Width = 496
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Font.Height = -12 Font.Height = -12
@ -341,7 +338,6 @@ object MainForm: TMainForm
Height = 496 Height = 496
Top = 36 Top = 36
Width = 853 Width = 853
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Font.Height = -12 Font.Height = -12
@ -388,7 +384,6 @@ object MainForm: TMainForm
Height = 532 Height = 532
Top = 0 Top = 0
Width = 813 Width = 813
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Align = alClient Align = alClient
@ -436,7 +431,6 @@ object MainForm: TMainForm
Height = 23 Height = 23
Top = 24 Top = 24
Width = 323 Width = 323
DataStore = VpBufDSDataStore1
Style = csDropDownList Style = csDropDownList
end end
end end
@ -689,7 +683,6 @@ object MainForm: TMainForm
Width = 5 Width = 5
end end
object VpControlLink1: TVpControlLink object VpControlLink1: TVpControlLink
DataStore = VpBufDSDataStore1
LocalizationFile = '../../source/vplocalize.xml' LocalizationFile = '../../source/vplocalize.xml'
Printer.BottomMargin = 5 Printer.BottomMargin = 5
Printer.DayStart = h_08 Printer.DayStart = h_08
@ -783,7 +776,6 @@ object MainForm: TMainForm
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.04' Version = 'v1.04'
DataStore = VpBufDSDataStore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
Placement.Top = 10 Placement.Top = 10
@ -793,42 +785,6 @@ object MainForm: TMainForm
left = 312 left = 312
top = 280 top = 280
end end
object VpBufDSDataStore1: TVpBufDSDataStore
CategoryColorMap.Category0.BackgroundColor = clSkyBlue
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Appointment'
CategoryColorMap.Category1.BackgroundColor = 13290239
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Urgent'
CategoryColorMap.Category2.BackgroundColor = 16777175
CategoryColorMap.Category2.Color = clTeal
CategoryColorMap.Category2.Description = 'Meetings'
CategoryColorMap.Category3.BackgroundColor = 11468799
CategoryColorMap.Category3.Color = clYellow
CategoryColorMap.Category3.Description = 'Travel'
CategoryColorMap.Category4.BackgroundColor = 15332329
CategoryColorMap.Category4.Color = clMoneyGreen
CategoryColorMap.Category4.Description = 'Private'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9'
EnableEventTimer = True
PlayEventSounds = True
OnPlaySound = VpBufDSDataStore1PlaySound
AutoConnect = True
AutoCreate = True
DayBuffer = 31
Directory = 'data'
left = 312
top = 128
end
object ImageList1: TImageList object ImageList1: TImageList
Height = 32 Height = 32
Width = 32 Width = 32
@ -2047,7 +2003,6 @@ object MainForm: TMainForm
end end
object VpPrintPreviewDialog1: TVpPrintPreviewDialog object VpPrintPreviewDialog1: TVpPrintPreviewDialog
Version = 'v1.04' Version = 'v1.04'
DataStore = VpBufDSDataStore1
BottomMargin = 0 BottomMargin = 0
ControlLink = VpControlLink1 ControlLink = VpControlLink1
EndDate = 42561.5151169907 EndDate = 42561.5151169907
@ -2067,7 +2022,6 @@ object MainForm: TMainForm
end end
object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog
Version = 'v1.04' Version = 'v1.04'
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter

View File

@ -10,9 +10,10 @@ uses
{$ENDIF} {$ENDIF}
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, LCLVersion, ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, LCLVersion,
VpBaseDS, VpDayView, // VpBufDS,
VpBaseDS, VpDayView,
VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg, VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg,
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types, VpContactButtons, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
VpBase, VpCalendar; VpBase, VpCalendar;
type type
@ -75,7 +76,6 @@ type
Splitter2: TSplitter; Splitter2: TSplitter;
Splitter3: TSplitter; Splitter3: TSplitter;
DaysTrackBar: TTrackBar; DaysTrackBar: TTrackBar;
VpBufDSDataStore1: TVpBufDSDataStore;
VpContactButtonBar1: TVpContactButtonBar; VpContactButtonBar1: TVpContactButtonBar;
VpContactGrid1: TVpContactGrid; VpContactGrid1: TVpContactGrid;
VpControlLink1: TVpControlLink; VpControlLink1: TVpControlLink;
@ -118,11 +118,13 @@ type
const AWavFile: String; AMode: TVpPlaySoundMode); const AWavFile: String; AMode: TVpPlaySoundMode);
procedure VpNavBar1ItemClick(Sender: TObject; Button: TMouseButton; procedure VpNavBar1ItemClick(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; Index: Integer); Shift: TShiftState; Index: Integer);
private private
{ private declarations } { private declarations }
FLang: String; FLang: String;
FActiveView: Integer; FActiveView: Integer;
FVisibleDays: Integer; FVisibleDays: Integer;
// Datastore: TVpCustomDatastore;
procedure PopulateLanguages; procedure PopulateLanguages;
procedure PositionControls; procedure PositionControls;
procedure SetActiveView(AValue: Integer); procedure SetActiveView(AValue: Integer);
@ -169,6 +171,7 @@ uses
{$ENDIF} {$ENDIF}
IniFiles, Math, Printers, IniFiles, Math, Printers,
VpMisc, VpPrtFmt, VpMisc, VpPrtFmt,
demoDatamodule,
sound, ExVpRptSetup; sound, ExVpRptSetup;
const const
@ -407,17 +410,52 @@ end;
procedure TMainForm.FormCreate(Sender: TObject); procedure TMainForm.FormCreate(Sender: TObject);
var var
lastRes: TVpResource; lastRes: TVpResource;
ds: TVpCustomDataStore;
begin begin
(*
Datastore := TVpBufDSDatastore.Create(self);
with Datastore as TVpBufDSDatastore do begin
CategoryColorMap.Category0.BackgroundColor := clSkyBlue;
CategoryColorMap.Category0.Color := clNavy;
CategoryColorMap.Category0.Description := 'Appointment';
CategoryColorMap.Category1.BackgroundColor := 13290239;
CategoryColorMap.Category1.Color := clRed;
CategoryColorMap.Category1.Description := 'Urgent';
CategoryColorMap.Category2.BackgroundColor := 16777175;
CategoryColorMap.Category2.Color := clTeal;
CategoryColorMap.Category2.Description := 'Meetings';
CategoryColorMap.Category3.BackgroundColor := 11468799;
CategoryColorMap.Category3.Color := clYellow;
CategoryColorMap.Category3.Description := 'Travel';
CategoryColorMap.Category4.BackgroundColor := 15332329;
CategoryColorMap.Category4.Color := clMoneyGreen;
CategoryColorMap.Category4.Description := 'Private';
EnableEventTimer := True;
PlayEventSounds := True;
OnPlaySound := @VpBufDSDataStore1PlaySound;
{$IFDEF WINDOWS}
MediaFolder := AppendPathDelim(SysUtils.GetEnvironmentVariable('SYSTEMROOT')) + 'media';
{$ENDIF}
DayBuffer := 31;
Directory := 'data';
Connected := true;
end;
VpControlLink1.Datastore := Datastore;
*)
// Establish connection of datastore (resides in a datamodule) to all
// dependent controls.
VpControlLink1.Datastore := DemoDM.VpBufDSDatastore1;
PopulateLanguages; PopulateLanguages;
ReadIni; ReadIni;
ds := VpControlLink1.Datastore; with VpControlLink1.Datastore do
if ds.Resources.Count > 0 then if Resources.Count > 0 then
begin begin
lastRes := ds.Resources.Items[ds.Resources.Count-1]; lastRes := Resources.Items[Resources.Count-1];
ds.ResourceID := lastRes.ResourceID; Resource := lastRes;
end; end;
end; end;
procedure TMainForm.MnuAboutClick(Sender: TObject); procedure TMainForm.MnuAboutClick(Sender: TObject);

View File

@ -1,2 +1,7 @@
This demo shows many of the possibilities of the Turbo Power VisualPlanIt package. This demo shows many of the possibilities of the Turbo Power VisualPlanIt
package.
In this example the datastore resides in a datamodule to hide the type of
database connection from the main form.
It can also be used to test translations of strings. It can also be used to test translations of strings.

View File

@ -247,16 +247,6 @@ msgstr "Datei"
msgid "Help" msgid "Help"
msgstr "Hilfe" msgstr "Hilfe"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "Über Visual PlanIt" msgstr "Über Visual PlanIt"

View File

@ -241,16 +241,6 @@ msgstr "Bestand"
msgid "Help" msgid "Help"
msgstr "Help" msgstr "Help"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "Over Visual PlanIt" msgstr "Over Visual PlanIt"

View File

@ -236,16 +236,6 @@ msgstr ""
msgid "Help" msgid "Help"
msgstr "" msgstr ""
#: tmainform.menuitem3.caption
msgctxt "TMAINFORM.MENUITEM3.CAPTION"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "" msgstr ""

View File

@ -250,16 +250,6 @@ msgstr "Файл"
msgid "Help" msgid "Help"
msgstr "Справка" msgstr "Справка"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "О Visual PlanIt" msgstr "О Visual PlanIt"