Recent

Author Topic: Dbgrid1.Columns[x].DisplayFormat doesn't work with String types  (Read 1255 times)

Gald

  • Full Member
  • ***
  • Posts: 107
Dbgrid1.Columns[x].DisplayFormat doesn't work with String types
« on: December 06, 2020, 03:25:21 am »
The title says everything.  :D

I don't know if it's intentional or not, but the MaskEdit property on DataSet's Field can do it very well.

Tested in V.2.1.0 r64158.
« Last Edit: December 06, 2020, 03:26:55 am by Gald »
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

dsiders

  • Hero Member
  • *****
  • Posts: 1509
Re: Dbgrid1.Columns[x].DisplayFormat doesn't work with String types
« Reply #1 on: December 06, 2020, 04:58:27 am »
The title says everything.  :D

I don't know if it's intentional or not, but the MaskEdit property on DataSet's Field can do it very well.

Tested in V.2.1.0 r64158.

TColumn does not apply DisplayFormat to anything other than TNumericField and TDateTimeField. And the reason is that DisplayFormat does not exist in the FCL DB classes for any other field type.
« Last Edit: December 06, 2020, 05:03:02 am by dsiders »

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Dbgrid1.Columns[x].DisplayFormat doesn't work with String types
« Reply #2 on: December 06, 2020, 06:03:30 am »
DisplayFormat does not exist in the FCL DB classes for any other field type.

So it's not implemented yet or never will be?
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

dsiders

  • Hero Member
  • *****
  • Posts: 1509
Re: Dbgrid1.Columns[x].DisplayFormat doesn't work with String types
« Reply #3 on: December 06, 2020, 07:02:16 am »
DisplayFormat does not exist in the FCL DB classes for any other field type.

So it's not implemented yet or never will be?

I think we've already established it does not exist right now. I'm not an FPC developer, so I would not know what they plan to do in the future.

You can always submit a "feature request" to the bug tracker... but Delphi compatibility is pretty high on their list of requirements. And it's not in the Delphi TStringField either.

 

TinyPortal © 2005-2018