Examples: restore old version without MemDataset

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2781 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2013-08-30 07:58:45 +00:00
parent 5b451c8cec
commit 37ae35db29
10 changed files with 104 additions and 128 deletions

View File

@ -1,11 +1,11 @@
object Form1: TForm1 object Form1: TForm1
Left = 379 Left = 307
Height = 340 Height = 331
Top = 214 Top = 233
Width = 411 Width = 436
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 340 ClientHeight = 331
ClientWidth = 411 ClientWidth = 436
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.1' LCLVersion = '1.1'
object Label1: TLabel object Label1: TLabel
@ -35,9 +35,9 @@ object Form1: TForm1
TabOrder = 4 TabOrder = 4
end end
object BitBtn1: TBitBtn object BitBtn1: TBitBtn
Left = 318 Left = 343
Height = 30 Height = 30
Top = 297 Top = 288
Width = 77 Width = 77
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
Caption = '&Cerrar' Caption = '&Cerrar'
@ -46,7 +46,7 @@ object Form1: TForm1
TabOrder = 5 TabOrder = 5
end end
object JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit object JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit
Left = 300 Left = 298
Height = 27 Height = 27
Top = 173 Top = 173
Width = 80 Width = 80
@ -59,7 +59,7 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JDBLabeledCurrencyEdit1 EditLabel.AnchorSideRight.Control = JDBLabeledCurrencyEdit1
EditLabel.AnchorSideRight.Side = asrBottom EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledCurrencyEdit1 EditLabel.AnchorSideBottom.Control = JDBLabeledCurrencyEdit1
EditLabel.Left = 300 EditLabel.Left = 298
EditLabel.Height = 17 EditLabel.Height = 17
EditLabel.Top = 153 EditLabel.Top = 153
EditLabel.Width = 80 EditLabel.Width = 80
@ -90,6 +90,7 @@ object Form1: TForm1
object JDBLabeledDateEdit1: TJDBLabeledDateEdit object JDBLabeledDateEdit1: TJDBLabeledDateEdit
Left = 106 Left = 106
Height = 27 Height = 27
Hint = 'Try Alt+Down arrow key to show the calendar'
Top = 173 Top = 173
Width = 80 Width = 80
DataField = 'DATE' DataField = 'DATE'
@ -105,10 +106,12 @@ object Form1: TForm1
EditLabel.Width = 80 EditLabel.Width = 80
EditLabel.Caption = 'Date' EditLabel.Caption = 'Date'
EditLabel.ParentColor = False EditLabel.ParentColor = False
ParentShowHint = False
ShowHint = True
TabOrder = 1 TabOrder = 1
end end
object JDBLabeledIntegerEdit2: TJDBLabeledIntegerEdit object JDBLabeledIntegerEdit2: TJDBLabeledIntegerEdit
Left = 216 Left = 214
Height = 27 Height = 27
Top = 173 Top = 173
Width = 80 Width = 80
@ -119,7 +122,7 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JDBLabeledIntegerEdit2 EditLabel.AnchorSideRight.Control = JDBLabeledIntegerEdit2
EditLabel.AnchorSideRight.Side = asrBottom EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit2 EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit2
EditLabel.Left = 216 EditLabel.Left = 214
EditLabel.Height = 17 EditLabel.Height = 17
EditLabel.Top = 153 EditLabel.Top = 153
EditLabel.Width = 80 EditLabel.Width = 80
@ -128,38 +131,13 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
end end
object Datasource1: TDatasource object Datasource1: TDatasource
DataSet = MemDataset1 DataSet = BufDataset1
left = 224 left = 336
top = 8 top = 8
end end
object MemDataset1: TMemDataset object BufDataset1: TBufDataset
Active = True FieldDefs = <>
FieldDefs = < left = 248
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
top = 8 top = 8
end end
end end

View File

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

View File

@ -27,19 +27,16 @@
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="4"> <RequiredPackages Count="3">
<Item1> <Item1>
<PackageName Value="jujiboutils"/> <PackageName Value="jujiboutils"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="MemDSLaz"/> <PackageName Value="FCL"/>
</Item2> </Item2>
<Item3> <Item3>
<PackageName Value="FCL"/>
</Item3>
<Item4>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item4> </Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>

View File

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

View File

@ -1,12 +1,13 @@
object Form1: TForm1 object Form1: TForm1
Left = 365 Left = 365
Height = 184 Height = 184
Hint = 'Try Alt+Down arrow key to show the calendar'
Top = 261 Top = 261
Width = 444 Width = 445
Caption = 'Example' Caption = 'Example'
ClientHeight = 184 ClientHeight = 184
ClientWidth = 444 ClientWidth = 445
OnCreate = FormCreate ShowHint = True
LCLVersion = '1.1' LCLVersion = '1.1'
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
@ -70,6 +71,7 @@ object Form1: TForm1
object JLabeledDateEdit1: TJLabeledDateEdit object JLabeledDateEdit1: TJLabeledDateEdit
Left = 190 Left = 190
Height = 27 Height = 27
Hint = 'Try Alt+Down Arrow key to show the calendar'
Top = 22 Top = 22
Width = 80 Width = 80
DisplayFormat = 'dd/mm/yy' DisplayFormat = 'dd/mm/yy'
@ -88,7 +90,7 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
end end
object JLabeledFloatEdit1: TJLabeledFloatEdit object JLabeledFloatEdit1: TJLabeledFloatEdit
Left = 302 Left = 298
Height = 27 Height = 27
Top = 22 Top = 22
Width = 80 Width = 80
@ -99,7 +101,7 @@ object Form1: TForm1
EditLabel.AnchorSideRight.Control = JLabeledFloatEdit1 EditLabel.AnchorSideRight.Control = JLabeledFloatEdit1
EditLabel.AnchorSideRight.Side = asrBottom EditLabel.AnchorSideRight.Side = asrBottom
EditLabel.AnchorSideBottom.Control = JLabeledFloatEdit1 EditLabel.AnchorSideBottom.Control = JLabeledFloatEdit1
EditLabel.Left = 302 EditLabel.Left = 298
EditLabel.Height = 17 EditLabel.Height = 17
EditLabel.Top = 2 EditLabel.Top = 2
EditLabel.Width = 80 EditLabel.Width = 80
@ -109,7 +111,7 @@ object Form1: TForm1
end end
end end
object BitBtn1: TBitBtn object BitBtn1: TBitBtn
Left = 333 Left = 334
Height = 30 Height = 30
Top = 138 Top = 138
Width = 91 Width = 91

View File

@ -22,7 +22,6 @@ type
JLabeledIntegerEdit1: TJLabeledIntegerEdit; JLabeledIntegerEdit1: TJLabeledIntegerEdit;
JLabeledIntegerEdit2: TJLabeledIntegerEdit; JLabeledIntegerEdit2: TJLabeledIntegerEdit;
Label1: TLabel; Label1: TLabel;
procedure FormCreate(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
@ -36,12 +35,5 @@ implementation
{$R *.lfm} {$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end. end.

View File

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

View File

@ -5,18 +5,19 @@ unit main;
interface interface
uses uses
Classes, SysUtils, memds, db, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, db, BufDataset, FileUtil, Forms, Controls, Graphics,
DbCtrls, DBGrids, JDBGridControl; Dialogs, DbCtrls, DBGrids, StdCtrls, JDBGridControl;
type type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BufDataset1: TBufDataset;
Datasource1: TDatasource; Datasource1: TDatasource;
DBNavigator1: TDBNavigator; DBNavigator1: TDBNavigator;
JDBGridControl1: TJDBGridControl; JDBGridControl1: TJDBGridControl;
MemDataset1: TMemDataset; Label1: TLabel;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
private private
{ private declarations } { private declarations }
@ -37,16 +38,24 @@ procedure TForm1.FormCreate(Sender: TObject);
var var
i: integer; i: integer;
begin 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 for i := 1 to 10 do
begin begin
MemDataset1.Append; BufDataset1.Append;
MemDataset1.FieldByName('ID').AsInteger := i; BufDataset1.FieldByName('ID').AsInteger := i;
MemDataset1.FieldByName('DATE').AsDateTime := Now; BufDataset1.FieldByName('DATE').AsDateTime := Now;
MemDataset1.FieldByName('QUANTITY').AsFloat := i * i * i; BufDataset1.FieldByName('QUANTITY').AsFloat := i * i * i;
MemDataset1.Post; BufDataset1.Post;
end; end;
MemDataset1.First; BufDataset1.First;
end; end;
end. end.

View File

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

View File

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