Programming => Packages and Libraries => Ported from Delphi/Kylix => Topic started by: NicoF on January 15, 2007, 10:01:31 am

Title: EditMask in dbgrid
Post by: NicoF on January 15, 2007, 10:01:31 am

I'm trying to convert a Delphi 7 / Kylix 3  program to Lazarus. So far so good.
But I got a problem that I am not able to solve.

In a dbgrid one of the fields is a date that the user must complete. The user must just fill in the
numbers not the slasses.
eg 15/01/2007 (user just fill in 15 01 2007 the EditMask will fill in the slasses)

In Delphi this works fine:
dbgTransactionInput.Fields[1].EditMask := '!00/00/0000;1;_' ;

In Lazarus I have not been able to get it to work.
I came across these posting in the user groups:

jesusr - May 21, 2005 - 03:27 AM

Field.EditMask is not implemented (yet) in fcl/db (the package from fpc that provides db suport),
Dbgrid provides a mean to set a editmask for each field using the OnFieldEditMask event,
unfortunately this event is not yet published Sad
It will be published in the next grid's update.

jesusr - Jul 29, 2005 - 01:38 AM

Field doesn't have a Editmask property yet, so the dbgrid implements an event that is called for
each field OnFieldEditMask, however it is disabled because TCustomMaskEdit behaves different
in windows and linux when using the editmask property. To enable the feature, recompile both
grids.pas and dbgrids.pas with OPT="-dEnableFieldEditMask" option it will probably work ok in
windows but expect problems in linux.

As they are 18 months old are they still true?
How do I use the OnFieldEditMask to make it work?
In the Project Roadmap the TMaskEdit is mentioned as working, does that apply to the dbgrid as well?
Are there any other way to make the EditMask in a dbgrid work?

TinyPortal © 2005-2018