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

View File

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

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm
Left = 301
Left = 368
Height = 596
Top = 177
Top = 134
Width = 959
Caption = 'Turbo Power VisualPlanIt Demo'
ClientHeight = 576
@ -9,7 +9,7 @@ object MainForm: TMainForm
Menu = MainMenu1
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
LCLVersion = '1.6.0.4'
LCLVersion = '1.7'
object Panel1: TPanel
Left = 125
Height = 576
@ -77,7 +77,6 @@ object MainForm: TMainForm
Height = 197
Top = 331
Width = 333
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alBottom
@ -118,7 +117,6 @@ object MainForm: TMainForm
Height = 284
Top = 42
Width = 333
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12
@ -273,7 +271,6 @@ object MainForm: TMainForm
Height = 528
Top = 0
Width = 496
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12
@ -341,7 +338,6 @@ object MainForm: TMainForm
Height = 496
Top = 36
Width = 853
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12
@ -388,7 +384,6 @@ object MainForm: TMainForm
Height = 532
Top = 0
Width = 813
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
@ -436,7 +431,6 @@ object MainForm: TMainForm
Height = 23
Top = 24
Width = 323
DataStore = VpBufDSDataStore1
Style = csDropDownList
end
end
@ -689,7 +683,6 @@ object MainForm: TMainForm
Width = 5
end
object VpControlLink1: TVpControlLink
DataStore = VpBufDSDataStore1
LocalizationFile = '../../source/vplocalize.xml'
Printer.BottomMargin = 5
Printer.DayStart = h_08
@ -783,7 +776,6 @@ object MainForm: TMainForm
end
object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.04'
DataStore = VpBufDSDataStore1
Options = []
Placement.Position = mpCenter
Placement.Top = 10
@ -793,42 +785,6 @@ object MainForm: TMainForm
left = 312
top = 280
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
Height = 32
Width = 32
@ -2047,7 +2003,6 @@ object MainForm: TMainForm
end
object VpPrintPreviewDialog1: TVpPrintPreviewDialog
Version = 'v1.04'
DataStore = VpBufDSDataStore1
BottomMargin = 0
ControlLink = VpControlLink1
EndDate = 42561.5151169907
@ -2067,7 +2022,6 @@ object MainForm: TMainForm
end
object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog
Version = 'v1.04'
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Options = []
Placement.Position = mpCenter

View File

@ -10,9 +10,10 @@ uses
{$ENDIF}
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, LCLVersion,
VpBaseDS, VpDayView,
// VpBufDS,
VpBaseDS, VpDayView,
VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg,
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
VpContactButtons, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
VpBase, VpCalendar;
type
@ -75,7 +76,6 @@ type
Splitter2: TSplitter;
Splitter3: TSplitter;
DaysTrackBar: TTrackBar;
VpBufDSDataStore1: TVpBufDSDataStore;
VpContactButtonBar1: TVpContactButtonBar;
VpContactGrid1: TVpContactGrid;
VpControlLink1: TVpControlLink;
@ -118,11 +118,13 @@ type
const AWavFile: String; AMode: TVpPlaySoundMode);
procedure VpNavBar1ItemClick(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; Index: Integer);
private
{ private declarations }
FLang: String;
FActiveView: Integer;
FVisibleDays: Integer;
// Datastore: TVpCustomDatastore;
procedure PopulateLanguages;
procedure PositionControls;
procedure SetActiveView(AValue: Integer);
@ -169,6 +171,7 @@ uses
{$ENDIF}
IniFiles, Math, Printers,
VpMisc, VpPrtFmt,
demoDatamodule,
sound, ExVpRptSetup;
const
@ -407,17 +410,52 @@ end;
procedure TMainForm.FormCreate(Sender: TObject);
var
lastRes: TVpResource;
ds: TVpCustomDataStore;
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;
ReadIni;
ds := VpControlLink1.Datastore;
if ds.Resources.Count > 0 then
begin
lastRes := ds.Resources.Items[ds.Resources.Count-1];
ds.ResourceID := lastRes.ResourceID;
end;
with VpControlLink1.Datastore do
if Resources.Count > 0 then
begin
lastRes := Resources.Items[Resources.Count-1];
Resource := lastRes;
end;
end;
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.

View File

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

View File

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

View File

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

View File

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