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
Left = 285
Height = 243
Height = 332
Top = 159
Width = 366
Caption = 'Form1'
ClientHeight = 243
ClientHeight = 332
ClientWidth = 366
OnCreate = FormCreate
LCLVersion = '0.9.31'
@ -66,59 +66,78 @@ object Form1: TForm1
Caption = 'Total'
ParentColor = False
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
Left = 21
Height = 27
Top = 152
Width = 80
Alignment = taRightJustify
TabOrder = 1
DataField = 'ID'
DataSource = Datasource1
Alignment = taRightJustify
TabOrder = 2
end
object JDBDateEdit1: TJDBDateEdit
Left = 104
Height = 27
Top = 152
Width = 80
TabOrder = 2
DataField = 'DATE'
DataSource = Datasource1
TabOrder = 3
end
object JDBIntegerEdit2: TJDBIntegerEdit
Left = 187
Height = 27
Top = 152
Width = 80
Alignment = taRightJustify
TabOrder = 3
DataField = 'ID2'
DataSource = Datasource1
Alignment = taRightJustify
TabOrder = 4
end
object JDBCurrencyEdit1: TJDBCurrencyEdit
Left = 270
Left = 273
Height = 27
Top = 152
Width = 80
Alignment = taRightJustify
TabOrder = 4
Text = '0,00 €'
DisplayFormat = '#,0.00 €'
DisplayFormat = '#,0.00€'
DataField = 'TOTAL'
DataSource = Datasource1
Decimals = 2
end
object BitBtn1: TBitBtn
Left = 273
Height = 30
Top = 200
Width = 77
Anchors = [akRight, akBottom]
Caption = '&Cerrar'
Kind = bkClose
ModalResult = 11
Alignment = taRightJustify
TabOrder = 5
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
DataSet = MemDataset1
left = 224

View File

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

View File

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

View File

@ -12,7 +12,7 @@
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Files Count="4">
<Files Count="7">
<Item1>
<Filename Value="src/jdbcurrencyedit.pas"/>
<HasRegisterProc Value="True"/>
@ -32,6 +32,21 @@
<Filename Value="src/jcontrolutils.pas"/>
<UnitName Value="jcontrolutils"/>
</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>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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