Changed parents. Updated example

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1973 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2011-09-20 08:31:40 +00:00
parent b985842532
commit 3bd0a2f13e
11 changed files with 117 additions and 101 deletions

View File

@ -1,10 +1,10 @@
object Form1: TForm1 object Form1: TForm1
Left = 285 Left = 285
Height = 243 Height = 332
Top = 159 Top = 159
Width = 366 Width = 366
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 243 ClientHeight = 332
ClientWidth = 366 ClientWidth = 366
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.31' LCLVersion = '0.9.31'
@ -66,59 +66,78 @@ object Form1: TForm1
Caption = 'Total' Caption = 'Total'
ParentColor = False ParentColor = False
end end
object BitBtn1: TBitBtn
Left = 273
Height = 30
Top = 289
Width = 77
Anchors = [akRight, akBottom]
Caption = '&Cerrar'
Kind = bkClose
ModalResult = 11
TabOrder = 1
end
object JDBIntegerEdit1: TJDBIntegerEdit object JDBIntegerEdit1: TJDBIntegerEdit
Left = 21 Left = 21
Height = 27 Height = 27
Top = 152 Top = 152
Width = 80 Width = 80
Alignment = taRightJustify
TabOrder = 1
DataField = 'ID' DataField = 'ID'
DataSource = Datasource1 DataSource = Datasource1
Alignment = taRightJustify
TabOrder = 2
end end
object JDBDateEdit1: TJDBDateEdit object JDBDateEdit1: TJDBDateEdit
Left = 104 Left = 104
Height = 27 Height = 27
Top = 152 Top = 152
Width = 80 Width = 80
TabOrder = 2
DataField = 'DATE' DataField = 'DATE'
DataSource = Datasource1 DataSource = Datasource1
TabOrder = 3
end end
object JDBIntegerEdit2: TJDBIntegerEdit object JDBIntegerEdit2: TJDBIntegerEdit
Left = 187 Left = 187
Height = 27 Height = 27
Top = 152 Top = 152
Width = 80 Width = 80
Alignment = taRightJustify
TabOrder = 3
DataField = 'ID2' DataField = 'ID2'
DataSource = Datasource1 DataSource = Datasource1
Alignment = taRightJustify
TabOrder = 4
end end
object JDBCurrencyEdit1: TJDBCurrencyEdit object JDBCurrencyEdit1: TJDBCurrencyEdit
Left = 270 Left = 273
Height = 27 Height = 27
Top = 152 Top = 152
Width = 80 Width = 80
Alignment = taRightJustify DisplayFormat = '#,0.00€'
TabOrder = 4
Text = '0,00 €'
DisplayFormat = '#,0.00 €'
DataField = 'TOTAL' DataField = 'TOTAL'
DataSource = Datasource1 DataSource = Datasource1
Decimals = 2 Decimals = 2
end Alignment = taRightJustify
object BitBtn1: TBitBtn
Left = 273
Height = 30
Top = 200
Width = 77
Anchors = [akRight, akBottom]
Caption = '&Cerrar'
Kind = bkClose
ModalResult = 11
TabOrder = 5 TabOrder = 5
end end
object JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit
Left = 270
Height = 27
Top = 200
Width = 80
DisplayFormat = '#,0.00€'
DataField = 'TOTAL'
DataSource = Datasource1
Decimals = 2
Alignment = taRightJustify
EditLabel.AnchorSideLeft.Control = JDBLabeledCurrencyEdit1
EditLabel.AnchorSideBottom.Control = JDBLabeledCurrencyEdit1
EditLabel.Left = 270
EditLabel.Height = 18
EditLabel.Top = 179
EditLabel.Width = 84
EditLabel.Caption = 'Total (labeled)'
EditLabel.ParentColor = False
TabOrder = 6
end
object Datasource1: TDatasource object Datasource1: TDatasource
DataSet = MemDataset1 DataSet = MemDataset1
left = 224 left = 224

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, db, memds, FileUtil, Forms, Controls, Graphics, Classes, SysUtils, db, memds, FileUtil, Forms, Controls, Graphics,
Dialogs, StdCtrls, DbCtrls, Buttons, jdbintegeredit, jdbdateedit, Dialogs, StdCtrls, DbCtrls, Buttons, jdbintegeredit, jdbdateedit,
jdbcurrencyedit; jdbcurrencyedit, jdblabeledcurrencyedit;
type type
@ -21,6 +21,7 @@ type
JDBDateEdit1: TJDBDateEdit; JDBDateEdit1: TJDBDateEdit;
JDBIntegerEdit1: TJDBIntegerEdit; JDBIntegerEdit1: TJDBIntegerEdit;
JDBIntegerEdit2: TJDBIntegerEdit; JDBIntegerEdit2: TJDBIntegerEdit;
JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;

View File

@ -6,7 +6,6 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<Icon Value="0"/>
</General> </General>
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>

View File

@ -12,7 +12,7 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Files Count="4"> <Files Count="7">
<Item1> <Item1>
<Filename Value="src/jdbcurrencyedit.pas"/> <Filename Value="src/jdbcurrencyedit.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
@ -32,6 +32,21 @@
<Filename Value="src/jcontrolutils.pas"/> <Filename Value="src/jcontrolutils.pas"/>
<UnitName Value="jcontrolutils"/> <UnitName Value="jcontrolutils"/>
</Item4> </Item4>
<Item5>
<Filename Value="src/jdblabeledcurrencyedit.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="jdblabeledcurrencyedit"/>
</Item5>
<Item6>
<Filename Value="src/jdblabeleddateedit.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="jdblabeleddateedit"/>
</Item6>
<Item7>
<Filename Value="src/jdblabeledintegeredit.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="jdblabeledintegeredit"/>
</Item7>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -8,6 +8,7 @@ interface
uses uses
jdbcurrencyedit, jdbdateedit, jdbintegeredit, jcontrolutils, jdbcurrencyedit, jdbdateedit, jdbintegeredit, jcontrolutils,
jdblabeledcurrencyedit, jdblabeleddateedit, jdblabeledintegeredit,
LazarusPackageIntf; LazarusPackageIntf;
implementation implementation
@ -17,6 +18,9 @@ begin
RegisterUnit('jdbcurrencyedit', @jdbcurrencyedit.Register); RegisterUnit('jdbcurrencyedit', @jdbcurrencyedit.Register);
RegisterUnit('jdbdateedit', @jdbdateedit.Register); RegisterUnit('jdbdateedit', @jdbdateedit.Register);
RegisterUnit('jdbintegeredit', @jdbintegeredit.Register); RegisterUnit('jdbintegeredit', @jdbintegeredit.Register);
RegisterUnit('jdblabeledcurrencyedit', @jdblabeledcurrencyedit.Register);
RegisterUnit('jdblabeleddateedit', @jdblabeleddateedit.Register);
RegisterUnit('jdblabeledintegeredit', @jdblabeledintegeredit.Register);
end; end;
initialization initialization

View File

@ -29,7 +29,7 @@ type
{ TJDBCurrencyEdit } { TJDBCurrencyEdit }
TJDBCurrencyEdit = class(TEdit) TJDBCurrencyEdit = class(TCustomEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;

View File

@ -29,7 +29,7 @@ type
{ TJDBDateEdit } { TJDBDateEdit }
TJDBDateEdit = class(TEdit) TJDBDateEdit = class(TCustomEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;

View File

@ -29,7 +29,7 @@ type
{ TJDBIntegerEdit } { TJDBIntegerEdit }
TJDBIntegerEdit = class(TEdit) TJDBIntegerEdit = class(TCustomEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;

View File

@ -22,7 +22,7 @@ unit jdblabeledcurrencyedit;
interface interface
uses uses
Classes, LResources, Controls, StdCtrls, ExtCtrls, DB, DBCtrls, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls,
LMessages, LCLType, Dialogs, LMessages, LCLType, Dialogs,
SysUtils; SysUtils;
@ -30,7 +30,7 @@ type
{ TJDBLabeledCurrencyEdit } { TJDBLabeledCurrencyEdit }
TJDBLabeledCurrencyEdit = class(TLabeledEdit) TJDBLabeledCurrencyEdit = class(TCustomLabeledEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;
@ -82,32 +82,36 @@ type
property Decimals: integer read getDecimals write setDecimals; property Decimals: integer read getDecimals write setDecimals;
property ReadOnly: boolean read GetReadOnly write SetReadOnly default False; property ReadOnly: boolean read GetReadOnly write SetReadOnly default False;
// From TEdit
property Action; property Action;
property Align; property Align;
property Alignment; property Alignment;
property Anchors; property Anchors;
property AutoSize;
property AutoSelect; property AutoSelect;
property AutoSize;
property BidiMode; property BidiMode;
property BorderStyle;
property BorderSpacing; property BorderSpacing;
property BorderStyle;
property CharCase; property CharCase;
property Color; property Color;
property Constraints; property Constraints;
property DragCursor; property DragCursor;
property DragKind;
property DragMode; property DragMode;
property EchoMode; property EditLabel;
property Enabled; property Enabled;
property Font; property Font;
property HideSelection; property LabelPosition;
property LabelSpacing;
property MaxLength; property MaxLength;
property ParentBidiMode; property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChange; property OnChange;
property OnChangeBounds;
property OnClick; property OnClick;
property OnContextPopup;
property OnDblClick; property OnDblClick;
property OnDragDrop; property OnDragDrop;
property OnDragOver; property OnDragOver;
@ -119,21 +123,10 @@ type
property OnKeyPress; property OnKeyPress;
property OnKeyUp; property OnKeyUp;
property OnMouseDown; property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
property OnResize;
property OnStartDrag; property OnStartDrag;
property OnUTF8KeyPress; property OnUTF8KeyPress;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabStop;
property TabOrder;
property Visible;
end; end;
procedure Register; procedure Register;

View File

@ -22,14 +22,14 @@ unit jdblabeleddateedit;
interface interface
uses uses
Classes, LResources, Controls, StdCtrls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils;
type type
{ TJDBLabeledDateEdit } { TJDBLabeledDateEdit }
TJDBLabeledDateEdit = class(TLabeledEdit) TJDBLabeledDateEdit = class(TCustomLabeledEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;
@ -76,32 +76,36 @@ type
property DataSource: TDataSource read GetDataSource write SetDataSource; property DataSource: TDataSource read GetDataSource write SetDataSource;
property ReadOnly: boolean read GetReadOnly write SetReadOnly default False; property ReadOnly: boolean read GetReadOnly write SetReadOnly default False;
// From TEdit
property Action; property Action;
property Align; property Align;
property Alignment; property Alignment;
property Anchors; property Anchors;
property AutoSize;
property AutoSelect; property AutoSelect;
property AutoSize;
property BidiMode; property BidiMode;
property BorderStyle;
property BorderSpacing; property BorderSpacing;
property BorderStyle;
property CharCase; property CharCase;
property Color; property Color;
property Constraints; property Constraints;
property DragCursor; property DragCursor;
property DragKind;
property DragMode; property DragMode;
property EchoMode; property EditLabel;
property Enabled; property Enabled;
property Font; property Font;
property HideSelection; property LabelPosition;
property LabelSpacing;
property MaxLength; property MaxLength;
property ParentBidiMode; property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChange; property OnChange;
property OnChangeBounds;
property OnClick; property OnClick;
property OnContextPopup;
property OnDblClick; property OnDblClick;
property OnDragDrop; property OnDragDrop;
property OnDragOver; property OnDragOver;
@ -113,21 +117,10 @@ type
property OnKeyPress; property OnKeyPress;
property OnKeyUp; property OnKeyUp;
property OnMouseDown; property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
property OnResize;
property OnStartDrag; property OnStartDrag;
property OnUTF8KeyPress; property OnUTF8KeyPress;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabStop;
property TabOrder;
property Visible;
end; end;
procedure Register; procedure Register;
@ -149,10 +142,10 @@ procedure TJDBLabeledDateEdit.DataChange(Sender: TObject);
begin begin
if FDataLink.Field <> nil then if FDataLink.Field <> nil then
begin begin
if not Focused then if not Focused then
formatInput formatInput
else else
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
end end
else else
Text := ''; Text := '';
@ -278,7 +271,8 @@ begin
DataChange(Self); DataChange(Self);
end; end;
procedure TJDBLabeledDateEdit.Notification(AComponent: TComponent; Operation: TOperation); procedure TJDBLabeledDateEdit.Notification(AComponent: TComponent;
Operation: TOperation);
begin begin
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
// clean up // clean up
@ -361,5 +355,3 @@ end;
end. end.

View File

@ -22,7 +22,7 @@ unit jdblabeledintegeredit;
interface interface
uses uses
Classes, LResources, Controls, StdCtrls, ExtCtrls, DB, DBCtrls, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls,
LMessages, LCLType, Dialogs, LMessages, LCLType, Dialogs,
SysUtils; SysUtils;
@ -30,7 +30,7 @@ type
{ TJDBLabeledIntegerEdit } { TJDBLabeledIntegerEdit }
TJDBLabeledIntegerEdit = class(TLabeledEdit) TJDBLabeledIntegerEdit = class(TCustomLabeledEdit)
private private
fFormat: string; fFormat: string;
FDataLink: TFieldDataLink; FDataLink: TFieldDataLink;
@ -77,32 +77,36 @@ type
property DataSource: TDataSource read GetDataSource write SetDataSource; property DataSource: TDataSource read GetDataSource write SetDataSource;
property ReadOnly: boolean read GetReadOnly write SetReadOnly default False; property ReadOnly: boolean read GetReadOnly write SetReadOnly default False;
// From TEdit
property Action; property Action;
property Align; property Align;
property Alignment; property Alignment;
property Anchors; property Anchors;
property AutoSize;
property AutoSelect; property AutoSelect;
property AutoSize;
property BidiMode; property BidiMode;
property BorderStyle;
property BorderSpacing; property BorderSpacing;
property BorderStyle;
property CharCase; property CharCase;
property Color; property Color;
property Constraints; property Constraints;
property DragCursor; property DragCursor;
property DragKind;
property DragMode; property DragMode;
property EchoMode; property EditLabel;
property Enabled; property Enabled;
property Font; property Font;
property HideSelection; property LabelPosition;
property LabelSpacing;
property MaxLength; property MaxLength;
property ParentBidiMode; property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChange; property OnChange;
property OnChangeBounds;
property OnClick; property OnClick;
property OnContextPopup;
property OnDblClick; property OnDblClick;
property OnDragDrop; property OnDragDrop;
property OnDragOver; property OnDragOver;
@ -114,21 +118,10 @@ type
property OnKeyPress; property OnKeyPress;
property OnKeyUp; property OnKeyUp;
property OnMouseDown; property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
property OnResize;
property OnStartDrag; property OnStartDrag;
property OnUTF8KeyPress; property OnUTF8KeyPress;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabStop;
property TabOrder;
property Visible;
end; end;
procedure Register; procedure Register;