View Issue Details

IDProjectCategoryView StatusLast Update
0015189LazarusDatabasepublic2015-03-17 20:39
ReporterLacaK Assigned ToJesus Reyes  
Status closedResolutionfixed 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0015189: TDBDateEdit - data-aware TDateEdit
DescriptionCurrently there is TDateEdit (on Misc palette), please add also data-aware TDBDateEdit (on Data Controls palette)
Additional InformationSome discussion with attached code can be found at,7931.0.html
TagsNo tags attached.
Fixed in Revision47208
Attached Files


related to 0027672 resolvedJuha Manninen Icon for TDBDateEdit is missing in the "Data Controls" palette 


2010-01-04 08:46


dbdateedit.pp (1,779 bytes)   
unit DBDateEdit;


  Classes, SysUtils, LCLType, LMessages,
  DB, DBCtrls, editbtn;

  { TDBDateEdit }

  TDBDateEdit = class(TDateEdit)
    FDataLink: TFieldDataLink;

    procedure DataChange(Sender: TObject);
    procedure UpdateData(Sender: TObject);
    procedure FocusRequest(Sender: TObject);
    procedure ActiveChange(Sender: TObject);
    procedure LayoutChange(Sender: TObject);
    function GetDataField: string;
    function GetDataSource: TDataSource;
    procedure SetDataField(const Value: string);
    procedure SetDataSource(Value: TDataSource);
    procedure CMGetDataLink(var Message: TLMessage); message CM_GETDATALINK;
    function GetField: TField;

    function GetReadOnly: Boolean; override;
    procedure SetReadOnly(Value: Boolean); override;
    procedure KeyDown(var Key: Word; Shift: TShiftState); override;
    procedure DoButtonClick(Sender: TObject); override;

    procedure Loaded; override;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Change; override;
    procedure Reset; override;

    procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
    procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;

    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property Field: TField read GetField;

    property DataField: string read GetDataField write SetDataField;
    property DataSource: TDataSource read GetDataSource write SetDataSource;

    property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;



dbdateedit.pp (1,779 bytes)   

2010-01-04 08:47 (3,627 bytes)


2010-01-04 08:57

developer   ~0033449

I uploaded implementation based on editbtn.TDateEdit and some code taken from TDBEdit.

But thinking again about subject, I have also another idea -> what do you think about creating general TDBEditBtn = data-aware edit-button component, which will have property Kind: TDBEditBtnKind=(ebkNone, ebkCalendar, ebkDots, ebkLookup)

In database application I often use edit with button for these reasons:
1. Select date from calendar (ebkCalendar)
2. Select "next value" for field (ebkDots="...")
3. Select "foreign key" from referenced table (for example customer code from customer list) (ebkLookup)

Vincent Snijders

2010-10-27 15:22

manager   ~0042203

Jesus, can you review this patch?

Jesus Reyes

2010-12-12 19:18

developer   ~0044194

Last edited: 2010-12-12 19:26

This patch has a couple of issues, first the unit name and the class match the ones from rx controls, it doesn't include provision for install it in IDE. I fixed both issues by renaming the class and the unit and making the necessary changes so it appears in component palette. The next problem is that although selecting a date from calendar it sets the linked dataset in edit state, the field content doesn't really changes and any information previously in field is lost once the record is posted. NOTE: This issue may be related to a FPC bug, currently as long as I tested, FPC cannot convert a shortdate formated string if it include month names, it works only if month is numeric form.

Currently I don't have more time to fix the remaining problems, so I'm changing the target version of this issue.

Vincent Snijders

2010-12-12 19:32

manager   ~0044195

I updated the LazTarget Field too.


2012-07-31 15:05

developer   ~0061324

Last edited: 2012-08-01 08:24

@RX Controls:
AFAIK RXLib has also TDateEdit (beside TDBDateEdit) and Lazarus already has own TDateEdit, so there is already collision between RXLib and Lazarus, so I think, that adding TDBDateEdit is not a problem from this POV
(i do not like renaming nice TDBDateEdit to something else ;-))

Add TDBDateEdit into list in Register procedure in dbctrls.pp ?

IMHO they can be fixed (later), if there will be decision add TDBDateEdit to LCL

Edit:I uploaded v.2 slightly optimized, and fixed some minor issues

2012-08-01 08:21


dbdateedit.pp2 (1,683 bytes)

2012-08-01 08:22


dbdateedit.inc2 (3,462 bytes)

Jesus Reyes

2014-09-15 21:41

developer   ~0077280

Last edited: 2014-09-15 21:48

View 2 revisions

I'm sorry. I found two problems with the patch.

1. It's a db component but ...
    a) it looks like an external (to LCL) component, but it doesn't include it's own package, or
    b) it doesn't include a register procedure in order to register it self into the IDE (easily to solve) or the changes to registerlcl, etc. or
    c) it's not a patch (a diff) to be included in dbctrls.pp.

2. Because the LCL API has changed with the years, it doesn't compile anymore.
3. Not important: One thing is using a name unknowingly that is used by somebody else and another is using it knowing that is used by somebody else and having the chance to modify it, nevertheless one choose a possible collision.

I tried to include it directly in LCL using 1c, but 2 stopped me.

We need the following:

1. Somebody (lacaK?, wOvAN?) needs to bring this component up to date with the current LCL API (make it compile).
2. I would then make the necessary to integrate it into the LCL.
3. Feedback about the target Lazarus version (1.4 is ok to me if everything is fixed) or if authors are not interested anymore in this component.

Joel Mendes

2014-10-05 08:07

reporter   ~0077993

I have interest in this component.
I think he should be included in the unit DbCtrls.


2014-10-09 07:11

developer   ~0078091

@Jesus: Ok I will make changes, when I find some free time ... and I will upload patch here ...


2014-11-17 18:03

reporter   ~0079188

I could use this as well, the one from rx does not work properly on linux, gives a odd resourse error.


2014-11-17 20:48

reporter   ~0079190

Last edited: 2014-11-17 23:10

View 2 revisions

I added the one from 2012 to my project in Laz 1.2.6 and so far it seems to work ok. It compiles just fine.
The other thing lacking is a tdbcalcedit control and was thinking the existing one on the misc tab could also be extended the same way?


2014-11-17 22:37

reporter   ~0079194

the current implementation auto selects even when autoselect is set to false.
If I have a few on a form that where created in code for a "form View" they are all selected, but the other databound controls are not.


2014-11-17 23:34


image1.png (52,121 bytes)   
image1.png (52,121 bytes)   


2014-11-17 23:35

reporter   ~0079195

see attached image1.png to see what I mean about the auto selecting.


2014-12-12 12:06

developer (2,313 bytes)


2014-12-12 12:12

developer   ~0079760

Last edited: 2014-12-12 19:32

View 4 revisions
- added diff against dbctrls.pp (updated Register procedure, add include of, etc.)
- updated
- fixed autoselect
Complies for me with Lazarus 1.2.2
(I hope it is okay now.)

Alternative: create new unit: DBExtCtrls and put TDBDateEdit (include of ) there and in future may be also other new "non-standard" data-aware controls (like TDBCalendar).

Jesus Reyes

2014-12-12 22:58

developer   ~0079776

I'm sorry, got this errors when compiling with Lazarus trunk. We normally do not put new features in fixes, and it can't be merged to fixes if it doesn't compile in trunk.

/home/prog/lazarus/lcl/dbctrls.pp(1178,14) Error: (3058) There is no method in an ancestor class to be overridden: "GetReadOnly:Boolean;"
/home/prog/lazarus/lcl/dbctrls.pp(1179,15) Error: (3058) There is no method in an ancestor class to be overridden: "SetReadOnly(Boolean);"
/home/prog/lazarus/lcl/dbctrls.pp(1181,15) Error: (3058) There is no method in an ancestor class to be overridden: "DoButtonClick(TObject);"
/home/prog/lazarus/lcl/dbctrls.pp(1184,15) Error: (3058) There is no method in an ancestor class to be overridden: "Change;"
/home/prog/lazarus/lcl/dbctrls.pp(1419,1) Fatal: (10026) There were 4 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /home/prog/fpcbin_64/bin/ppcx64 returned an error exitcode


2014-12-15 15:01

developer (3,156 bytes)


2014-12-15 15:15

developer   ~0079826

Last edited: 2014-12-15 20:06

View 2 revisions

My apologies, next attempt in
- there is included also new unit DBExtCtrls if you decide not put new TDBDateEdit into dbctrls unit ... may be that in future there will be also others DB-aware controls f.e. useful is TDBEditButton (data-aware TEditButton) ... (and I am not sure if linker can eliminate unused classes from big unit ?)
- I wanted use EditingDone method for call UpdateRecord, but it seems, that TEditButton does not fire this method (so I have used EditExit)
- and I do not know why, but when I create TDBDateEdit at runtime, its Width is larger than Width=80 of TDateEdit created at design time

Jesus Reyes

2014-12-16 20:34

developer   ~0079856


Applied to trunk, I used dbextctrls unit for that.

1. The icon for the component is missing ...

2. I also compiled fpmake and makefile* files, but I didn't include them in the patch, it seemed to me that it removed too much and I'm not sure if that is ok, I let that for someone else.

Derit Agustin

2014-12-16 21:01

reporter   ~0079858

there no icon ?


2014-12-19 08:54


tdbdateedit.png (581 bytes)   
tdbdateedit.png (581 bytes)   


2014-12-19 08:55

developer   ~0079894

Added icon for TDBDateEdit by "howardpc" from forum:
(,26813.0.html )

Patyi Tibor

2014-12-19 09:44

reporter   ~0079895

TDBDateEdit has conflict by name with Rxnew controls TDBDateEdit !
One of them have to be renamed ...


2014-12-19 12:39

developer   ~0079898

Last edited: 2014-12-19 13:18

View 4 revisions

In pascal we have namespace per unit.
So in two different units we can have same named identifiers.
I see no problem if there exists in word same named component.
You either use "uses dbextctrls" or "uses dbdateedit" (unit named in RxLib).

On other side, I am not sure if in Lazarus can be registered on component palete two components with same name, which resides in different units ? (If YES, then IMO there is no problem;)

BTW RxLib already uses prefix "TRxDB..." for naming their DB-aware components (TRxDBTimeEdit, TRxDBCalcEdit, TRxDBCurrEdit, TRxDBComboBox, TRxDBGrid). So expand this naming scheme to all components also gives sense to me.

Juha Manninen

2015-03-17 16:42

developer   ~0082035

This can be resolved. The icon is added, Rx library is fixed etc.

Issue History

Date Modified Username Field Change
2009-11-26 07:38 LacaK New Issue
2009-11-26 07:38 LacaK Status new => assigned
2009-11-26 07:38 LacaK Assigned To => Joost van der Sluis
2009-11-26 12:01 Jonas Maebe Project FPC => Lazarus
2009-11-26 16:25 Vincent Snijders LazTarget => -
2009-11-26 16:25 Vincent Snijders Assigned To Joost van der Sluis =>
2009-11-26 16:25 Vincent Snijders Status assigned => acknowledged
2009-11-26 16:25 Vincent Snijders Category Database Components => Database
2009-11-26 16:25 Vincent Snijders Product Version 2.5.1 =>
2010-01-04 08:46 LacaK File Added: dbdateedit.pp
2010-01-04 08:47 LacaK File Added:
2010-01-04 08:57 LacaK Note Added: 0033449
2010-07-21 14:25 Felipe Monteiro de Carvalho LazTarget - => 0.9.30
2010-10-27 15:22 Vincent Snijders Note Added: 0042203
2010-10-27 15:22 Vincent Snijders Assigned To => Jesus Reyes
2010-10-27 15:22 Vincent Snijders Status acknowledged => assigned
2010-10-27 15:22 Vincent Snijders Target Version => 0.9.30
2010-12-12 19:18 Jesus Reyes Note Added: 0044194
2010-12-12 19:18 Jesus Reyes Target Version 0.9.30 => 0.99.0
2010-12-12 19:26 Jesus Reyes Note Edited: 0044194
2010-12-12 19:32 Vincent Snijders LazTarget 0.9.30 => 0.99.0
2010-12-12 19:32 Vincent Snijders Note Added: 0044195
2011-10-01 23:05 Felipe Monteiro de Carvalho LazTarget 0.99.0 => 1.2
2012-03-06 07:15 Paul Ishenin Target Version 0.99.0 => 1.2.0
2012-07-31 15:05 LacaK Note Added: 0061324
2012-08-01 08:21 LacaK File Added: dbdateedit.pp2
2012-08-01 08:22 LacaK File Added: dbdateedit.inc2
2012-08-01 08:24 LacaK Note Edited: 0061324
2014-01-14 15:10 Martin Friebe LazTarget 1.2 => 1.4
2014-01-14 15:12 Martin Friebe Target Version 1.2.0 => 1.4
2014-09-15 21:41 Jesus Reyes Note Added: 0077280
2014-09-15 21:41 Jesus Reyes Status assigned => feedback
2014-09-15 21:48 Jesus Reyes Note Edited: 0077280 View Revisions
2014-10-05 08:07 Joel Mendes Note Added: 0077993
2014-10-09 07:11 LacaK Note Added: 0078091
2014-10-09 07:11 LacaK Status feedback => assigned
2014-11-17 18:03 snorkel Note Added: 0079188
2014-11-17 20:48 snorkel Note Added: 0079190
2014-11-17 22:37 snorkel Note Added: 0079194
2014-11-17 23:10 snorkel Note Edited: 0079190 View Revisions
2014-11-17 23:34 snorkel File Added: image1.png
2014-11-17 23:35 snorkel Note Added: 0079195
2014-12-12 12:06 LacaK File Added:
2014-12-12 12:12 LacaK Note Added: 0079760
2014-12-12 19:29 LacaK Note Edited: 0079760 View Revisions
2014-12-12 19:31 LacaK Note Edited: 0079760 View Revisions
2014-12-12 19:32 LacaK Note Edited: 0079760 View Revisions
2014-12-12 22:58 Jesus Reyes Note Added: 0079776
2014-12-15 15:01 LacaK File Added:
2014-12-15 15:15 LacaK Note Added: 0079826
2014-12-15 20:06 LacaK Note Edited: 0079826 View Revisions
2014-12-16 20:34 Jesus Reyes Fixed in Revision => 47208
2014-12-16 20:34 Jesus Reyes Note Added: 0079856
2014-12-16 20:34 Jesus Reyes Status assigned => resolved
2014-12-16 20:34 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-12-16 20:34 Jesus Reyes Resolution open => fixed
2014-12-16 21:01 Derit Agustin Note Added: 0079858
2014-12-19 08:53 LacaK Status resolved => assigned
2014-12-19 08:53 LacaK Resolution fixed => reopened
2014-12-19 08:54 LacaK File Added: tdbdateedit.png
2014-12-19 08:55 LacaK Note Added: 0079894
2014-12-19 09:44 Patyi Tibor Note Added: 0079895
2014-12-19 12:39 LacaK Note Added: 0079898
2014-12-19 13:08 LacaK Note Edited: 0079898 View Revisions
2014-12-19 13:11 LacaK Note Edited: 0079898 View Revisions
2014-12-19 13:18 LacaK Note Edited: 0079898 View Revisions
2015-03-16 23:50 Juha Manninen Relationship added related to 0027672
2015-03-17 16:42 Juha Manninen Note Added: 0082035
2015-03-17 16:42 Juha Manninen Status assigned => resolved
2015-03-17 16:42 Juha Manninen Resolution reopened => fixed
2015-03-17 20:39 LacaK Status resolved => closed