Update examples and remove MemDataset dependency

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2775 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2013-08-20 11:55:37 +00:00
parent 9b89d94c74
commit 9c65a1b05d
10 changed files with 141 additions and 161 deletions

View File

@ -1,18 +1,18 @@
object Form1: TForm1
Left = 576
Height = 332
Top = 272
Width = 366
Left = 307
Height = 331
Top = 233
Width = 436
Caption = 'Form1'
ClientHeight = 332
ClientWidth = 366
ClientHeight = 331
ClientWidth = 436
OnCreate = FormCreate
LCLVersion = '0.9.31'
LCLVersion = '1.1'
object Label1: TLabel
Left = 13
Height = 18
Height = 17
Top = 16
Width = 150
Width = 149
Caption = 'Testing jujibo db controls'
ParentColor = False
end
@ -35,9 +35,9 @@ object Form1: TForm1
TabOrder = 4
end
object BitBtn1: TBitBtn
Left = 273
Left = 343
Height = 30
Top = 289
Top = 288
Width = 77
Anchors = [akRight, akBottom]
Caption = '&Cerrar'
@ -46,7 +46,7 @@ object Form1: TForm1
TabOrder = 5
end
object JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit
Left = 272
Left = 298
Height = 27
Top = 173
Width = 80
@ -59,9 +59,9 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JDBLabeledCurrencyEdit1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledCurrencyEdit1
EditLabel.Left = 272
EditLabel.Height = 18
EditLabel.Top = 152
EditLabel.Left = 298
EditLabel.Height = 17
EditLabel.Top = 153
EditLabel.Width = 80
EditLabel.Caption = 'Total'
EditLabel.ParentColor = False
@ -80,8 +80,8 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit1
EditLabel.Left = 21
EditLabel.Height = 18
EditLabel.Top = 153
EditLabel.Height = 17
EditLabel.Top = 154
EditLabel.Width = 80
EditLabel.Caption = 'Id'
EditLabel.ParentColor = False
@ -90,24 +90,28 @@ object Form1: TForm1
object JDBLabeledDateEdit1: TJDBLabeledDateEdit
Left = 106
Height = 27
Hint = 'Try Alt+Down arrow key to show the calendar'
Top = 173
Width = 80
DataField = 'DATE'
DataSource = Datasource1
ButtonWidth = 23
EditLabel.AnchorSideLeft.Control = JDBLabeledDateEdit1
EditLabel.AnchorSideRight.Control = JDBLabeledDateEdit1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledDateEdit1
EditLabel.Left = 106
EditLabel.Height = 18
EditLabel.Top = 152
EditLabel.Height = 17
EditLabel.Top = 153
EditLabel.Width = 80
EditLabel.Caption = 'Date'
EditLabel.ParentColor = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object JDBLabeledIntegerEdit2: TJDBLabeledIntegerEdit
Left = 188
Left = 214
Height = 27
Top = 173
Width = 80
@ -118,47 +122,22 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JDBLabeledIntegerEdit2
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit2
EditLabel.Left = 188
EditLabel.Height = 18
EditLabel.Top = 152
EditLabel.Left = 214
EditLabel.Height = 17
EditLabel.Top = 153
EditLabel.Width = 80
EditLabel.Caption = 'Id2'
EditLabel.ParentColor = False
TabOrder = 2
end
object Datasource1: TDatasource
DataSet = MemDataset1
left = 224
DataSet = BufDataset1
left = 336
top = 8
end
object MemDataset1: TMemDataset
Active = True
FieldDefs = <
item
Name = 'ID'
DataType = ftInteger
Precision = 0
Size = 0
end
item
Name = 'DATE'
DataType = ftDate
Precision = 0
Size = 0
end
item
Name = 'TOTAL'
DataType = ftFloat
Precision = 0
Size = 0
end
item
Name = 'ID2'
DataType = ftInteger
Precision = 0
Size = 0
end>
left = 184
object BufDataset1: TBufDataset
FieldDefs = <>
left = 248
top = 8
end
end

View File

@ -5,9 +5,9 @@ unit main;
interface
uses
Classes, SysUtils, DB, memds, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, DBCtrls, Buttons, jdblabeledcurrencyedit, jdblabeledintegeredit,
jdblabeleddateedit;
Classes, SysUtils, DB, BufDataset, FileUtil, Forms, Controls, Graphics,
Dialogs, StdCtrls, DBCtrls, Buttons, jdblabeledcurrencyedit,
jdblabeledintegeredit, jdblabeleddateedit;
type
@ -15,6 +15,7 @@ type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BufDataset1: TBufDataset;
Datasource1: TDatasource;
DBNavigator1: TDBNavigator;
JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit;
@ -24,7 +25,6 @@ type
Label1: TLabel;
Label4: TLabel;
Label5: TLabel;
MemDataset1: TMemDataset;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
@ -45,17 +45,26 @@ procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
// Create BufDataset
with BufDataset1.FieldDefs do
begin
Add('ID', ftInteger, 0, False);
Add('DATE', ftDate, 0, False);
Add('TOTAL', ftCurrency, 0, False);
Add('ID2', ftInteger, 0, False);
end;
BufDataset1.CreateDataset;
// populate the memDataset
for i := 1 to 10 do
begin
MemDataset1.Append;
MemDataset1.FieldByName('ID').AsInteger := i;
MemDataset1.FieldByName('DATE').AsDateTime := Now;
MemDataset1.FieldByName('ID2').AsInteger := i * i;
MemDataset1.FieldByName('TOTAL').AsFloat := i * i * i;
MemDataset1.Post;
BufDataset1.Append;
BufDataset1.FieldByName('ID').AsInteger := i;
BufDataset1.FieldByName('DATE').AsDateTime := Now;
BufDataset1.FieldByName('ID2').AsInteger := i * i;
BufDataset1.FieldByName('TOTAL').AsCurrency := i * i * i;
BufDataset1.Post;
end;
MemDataset1.First;
BufDataset1.First;
end;
end.

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
@ -25,22 +25,18 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<RequiredPackages Count="3">
<Item1>
<PackageName Value="jujiboutils"/>
</Item1>
<Item2>
<PackageName Value="MemDSLaz"/>
<PackageName Value="FCL"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
@ -52,13 +48,14 @@
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</Target>
@ -67,10 +64,6 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -8,8 +8,7 @@ uses
{$ENDIF}clocale,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main, memdslaz
{ you can add units after this };
Forms, main;
{$R *.res}

View File

@ -1,17 +1,19 @@
object Form1: TForm1
Left = 365
Height = 185
Top = 260
Width = 419
Height = 184
Hint = 'Try Alt+Down arrow key to show the calendar'
Top = 261
Width = 445
Caption = 'Example'
ClientHeight = 185
ClientWidth = 419
LCLVersion = '0.9.31'
ClientHeight = 184
ClientWidth = 445
ShowHint = True
LCLVersion = '1.1'
object Label1: TLabel
Left = 8
Height = 18
Height = 17
Top = 8
Width = 253
Width = 252
Caption = 'Testing non DB-Aware Input Controls'
Font.Height = 14
Font.Style = [fsBold]
@ -22,10 +24,10 @@ object Form1: TForm1
Left = 24
Height = 82
Top = 40
Width = 375
Width = 400
Caption = 'Labeled controls'
ClientHeight = 63
ClientWidth = 371
ClientWidth = 396
TabOrder = 0
object JLabeledIntegerEdit1: TJLabeledIntegerEdit
Left = 14
@ -39,8 +41,8 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JLabeledIntegerEdit1
EditLabel.Left = 14
EditLabel.Height = 18
EditLabel.Top = 2
EditLabel.Height = 17
EditLabel.Top = 3
EditLabel.Width = 80
EditLabel.Caption = 'Integer'
EditLabel.ParentColor = False
@ -59,8 +61,8 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JLabeledCurrencyEdit1
EditLabel.Left = 102
EditLabel.Height = 18
EditLabel.Top = 2
EditLabel.Height = 17
EditLabel.Top = 3
EditLabel.Width = 80
EditLabel.Caption = 'Currency'
EditLabel.ParentColor = False
@ -69,26 +71,28 @@ object Form1: TForm1
object JLabeledDateEdit1: TJLabeledDateEdit
Left = 190
Height = 27
Hint = 'Try Alt+Down Arrow key to show the calendar'
Top = 22
Width = 80
DisplayFormat = 'dd/mm/yy'
Value = 0
ButtonWidth = 23
EditLabel.AnchorSideLeft.Control = JLabeledDateEdit1
EditLabel.AnchorSideRight.Control = JLabeledDateEdit1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JLabeledDateEdit1
EditLabel.Left = 190
EditLabel.Height = 18
EditLabel.Top = 1
EditLabel.Height = 17
EditLabel.Top = 2
EditLabel.Width = 80
EditLabel.Caption = 'Date'
EditLabel.ParentColor = False
TabOrder = 2
end
object JLabeledFloatEdit1: TJLabeledFloatEdit
Left = 280
Left = 298
Height = 27
Top = 23
Top = 22
Width = 80
DisplayFormat = '#,0.00'
Decimals = 2
@ -97,8 +101,8 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JLabeledFloatEdit1
EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JLabeledFloatEdit1
EditLabel.Left = 280
EditLabel.Height = 18
EditLabel.Left = 298
EditLabel.Height = 17
EditLabel.Top = 2
EditLabel.Width = 80
EditLabel.Caption = 'Float'
@ -107,9 +111,9 @@ object Form1: TForm1
end
end
object BitBtn1: TBitBtn
Left = 308
Left = 334
Height = 30
Top = 139
Top = 138
Width = 91
Anchors = [akRight, akBottom]
Caption = '&Cerrar'

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
@ -18,13 +18,13 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="$(TestDir)/testnodb/"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
@ -45,13 +45,14 @@
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Version Value="11"/>
<Target>
<Filename Value="testnodb"/>
</Target>
@ -60,10 +61,6 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 347
ClientWidth = 419
OnCreate = FormCreate
LCLVersion = '0.9.31'
LCLVersion = '1.1'
object DBNavigator1: TDBNavigator
Left = 8
Height = 25
@ -29,57 +29,54 @@ object Form1: TForm1
object JDBGridControl1: TJDBGridControl
Left = 8
Height = 192
Top = 112
Top = 96
Width = 392
AlternateColor = clMoneyGreen
AutoFillColumns = True
Color = clWindow
Columns = <
item
Title.Caption = 'ID'
Title.PrefixOption = poNone
Width = 121
FieldName = 'ID'
Decimals = 0
MaxLength = 0
end
item
Title.Caption = 'DATE'
Title.PrefixOption = poNone
Width = 121
FieldName = 'DATE'
DisplayFormat = 'dd/mm/yyyy'
Decimals = 0
MaxLength = 0
end
item
Title.Caption = 'QUANTITY'
Title.PrefixOption = poNone
Width = 150
Width = 121
FieldName = 'QUANTITY'
DisplayFormat = '#,0.00000€'
Decimals = 0
MaxLength = 0
end>
DataSource = Datasource1
TabOrder = 1
end
object MemDataset1: TMemDataset
Active = True
FieldDefs = <
item
Name = 'ID'
DataType = ftInteger
Precision = 0
Size = 0
end
item
Name = 'DATE'
DataType = ftDate
Precision = 0
Size = 0
end
item
Name = 'QUANTITY'
DataType = ftFloat
Precision = 0
Size = 0
end>
left = 232
top = 8
object Label1: TLabel
Left = 13
Height = 17
Top = 296
Width = 391
Caption = 'Press Alt+Down arrow key while editing date to show the calendar'
ParentColor = False
end
object Datasource1: TDatasource
DataSet = MemDataset1
DataSet = BufDataset1
left = 324
top = 7
end
object BufDataset1: TBufDataset
FieldDefs = <>
left = 232
top = 7
end
end

View File

@ -5,18 +5,19 @@ unit main;
interface
uses
Classes, SysUtils, memds, db, FileUtil, Forms, Controls, Graphics, Dialogs,
DbCtrls, DBGrids, JDBGridControl;
Classes, SysUtils, db, BufDataset, FileUtil, Forms, Controls, Graphics,
Dialogs, DbCtrls, DBGrids, StdCtrls, JDBGridControl;
type
{ TForm1 }
TForm1 = class(TForm)
BufDataset1: TBufDataset;
Datasource1: TDatasource;
DBNavigator1: TDBNavigator;
JDBGridControl1: TJDBGridControl;
MemDataset1: TMemDataset;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
@ -37,16 +38,24 @@ procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
// populate the memDataset
// Create BufDataset
with BufDataset1.FieldDefs do
begin
Add('ID', ftInteger, 0, False);
Add('DATE', ftDate, 0, False);
Add('QUANTITY', ftCurrency, 0, False);
end;
BufDataset1.CreateDataset;
// populate
for i := 1 to 10 do
begin
MemDataset1.Append;
MemDataset1.FieldByName('ID').AsInteger := i;
MemDataset1.FieldByName('DATE').AsDateTime := Now;
MemDataset1.FieldByName('QUANTITY').AsFloat := i * i * i;
MemDataset1.Post;
BufDataset1.Append;
BufDataset1.FieldByName('ID').AsInteger := i;
BufDataset1.FieldByName('DATE').AsDateTime := Now;
BufDataset1.FieldByName('QUANTITY').AsFloat := i * i * i;
BufDataset1.Post;
end;
MemDataset1.First;
BufDataset1.First;
end;
end.

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
@ -25,10 +25,9 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<RequiredPackages Count="3">
<Item1>
<PackageName Value="jujiboutils"/>
</Item1>
@ -36,11 +35,8 @@
<PackageName Value="FCL"/>
</Item2>
<Item3>
<PackageName Value="MemDSLaz"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
@ -52,13 +48,14 @@
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Version Value="11"/>
<Target>
<Filename Value="testgridctr"/>
</Target>
@ -67,10 +64,6 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -7,7 +7,7 @@ uses
cthreads,
{$ENDIF}clocale,{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, memdslaz, main
Forms, main
{ you can add units after this };
{$R *.res}