From 3bd0a2f13ed267d8a764be07236aafd4fdbbe286 Mon Sep 17 00:00:00 2001 From: jujibo Date: Tue, 20 Sep 2011 08:31:40 +0000 Subject: [PATCH] Changed parents. Updated example git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1973 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../jujibo-utils/example1/main.lfm | 63 ++++++++++++------- .../jujibo-utils/example1/main.pas | 3 +- .../jujibo-utils/example1/project1.lpi | 1 - .../jujibo-utils/jujibocontrols.lpk | 17 ++++- .../jujibo-utils/jujibocontrols.pas | 4 ++ .../jujibo-utils/src/jdbcurrencyedit.pas | 2 +- .../jujibo-utils/src/jdbdateedit.pas | 2 +- .../jujibo-utils/src/jdbintegeredit.pas | 2 +- .../src/jdblabeledcurrencyedit.pas | 37 +++++------ .../jujibo-utils/src/jdblabeleddateedit.pas | 50 +++++++-------- .../src/jdblabeledintegeredit.pas | 37 +++++------ 11 files changed, 117 insertions(+), 101 deletions(-) diff --git a/components/jujiboutils/jujibo-utils/example1/main.lfm b/components/jujiboutils/jujibo-utils/example1/main.lfm index e9fe86fe0..d3ffd08ff 100644 --- a/components/jujiboutils/jujibo-utils/example1/main.lfm +++ b/components/jujiboutils/jujibo-utils/example1/main.lfm @@ -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 diff --git a/components/jujiboutils/jujibo-utils/example1/main.pas b/components/jujiboutils/jujibo-utils/example1/main.pas index 8322b5799..8390faa3a 100644 --- a/components/jujiboutils/jujibo-utils/example1/main.pas +++ b/components/jujiboutils/jujibo-utils/example1/main.pas @@ -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; diff --git a/components/jujiboutils/jujibo-utils/example1/project1.lpi b/components/jujiboutils/jujibo-utils/example1/project1.lpi index 8de0d3383..6a2806e75 100644 --- a/components/jujiboutils/jujibo-utils/example1/project1.lpi +++ b/components/jujiboutils/jujibo-utils/example1/project1.lpi @@ -6,7 +6,6 @@ - diff --git a/components/jujiboutils/jujibo-utils/jujibocontrols.lpk b/components/jujiboutils/jujibo-utils/jujibocontrols.lpk index 707ae7069..6915ee0d8 100644 --- a/components/jujiboutils/jujibo-utils/jujibocontrols.lpk +++ b/components/jujiboutils/jujibo-utils/jujibocontrols.lpk @@ -12,7 +12,7 @@ - + @@ -32,6 +32,21 @@ + + + + + + + + + + + + + + + diff --git a/components/jujiboutils/jujibo-utils/jujibocontrols.pas b/components/jujiboutils/jujibo-utils/jujibocontrols.pas index 62b2ed445..1098dc5c0 100644 --- a/components/jujiboutils/jujibo-utils/jujibocontrols.pas +++ b/components/jujiboutils/jujibo-utils/jujibocontrols.pas @@ -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 diff --git a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas index ad52f90f0..e0ae04355 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas @@ -29,7 +29,7 @@ type { TJDBCurrencyEdit } - TJDBCurrencyEdit = class(TEdit) + TJDBCurrencyEdit = class(TCustomEdit) private fFormat: string; FDataLink: TFieldDataLink; diff --git a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas index 0f7b06b0b..addce129f 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas @@ -29,7 +29,7 @@ type { TJDBDateEdit } - TJDBDateEdit = class(TEdit) + TJDBDateEdit = class(TCustomEdit) private fFormat: string; FDataLink: TFieldDataLink; diff --git a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas index 7deac7193..a219278da 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas @@ -29,7 +29,7 @@ type { TJDBIntegerEdit } - TJDBIntegerEdit = class(TEdit) + TJDBIntegerEdit = class(TCustomEdit) private fFormat: string; FDataLink: TFieldDataLink; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas index a21fde91e..b4cbf888d 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas @@ -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; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas index 9fdfdc4b3..9a7b7a6f4 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas @@ -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. - - diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas index bba4c35bc..fbb642947 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas @@ -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;