Page 1 of 1

DisplayFormat and DBgrid

Posted: 27.07.2022, 12:44
by nlanger
I have a strange effect.

If the ZQuery is opened and the display format is set for a DateTime field and the DateTime field is empty in the first record, the focus in the DBgrid is drawn incorrectly. The internal data record pointer was probably changed by "DisplayFormat" ?

See attachement

The focus is on the first sentence with a date. The record pointer is on record 1.

Norbert

Re: DisplayFormat and DBgrid

Posted: 27.07.2022, 16:20
by marsupilami
Hello Norbert,

I can confirm the problem on Delphi XE7. This doesn't happen on Lazarus. I also did the same thing with FireDAC and ODBC using SQL Native Client. It didn't happen there.
Bu then - I am not sure - how does DBGrid decide where to draw the focussed cell and where to draw the triangle? Usually I would expect the DBGrid to keep these things in sync?

Best regards,

Jan

Re: DisplayFormat and DBgrid

Posted: 28.07.2022, 08:22
by Fr0sT
marsupilami wrote: 27.07.2022, 16:20 Bu then - I am not sure - how does DBGrid decide where to draw the focussed cell and where to draw the triangle? Usually I would expect the DBGrid to keep these things in sync?
Nope. It's the dumbest feature of vanilla dbgrid IMHO and it lasts from the very beginning.

Re: DisplayFormat and DBgrid

Posted: 28.07.2022, 15:51
by nlanger
I'm running Delphi 10.4 and this only happens with ZQuery.
This does not happen with the FireDAC query or any other query.
I also often use the RxMemoryTable, and this effect does not occur there either.

Something is misaligned when setting "DisplayFormat". Does the ZQuery look for the first record where the format can be applied?

Norbert

Re: DisplayFormat and DBgrid

Posted: 29.07.2022, 08:33
by marsupilami
Fr0sT wrote: 28.07.2022, 08:22
marsupilami wrote: 27.07.2022, 16:20 Bu then - I am not sure - how does DBGrid decide where to draw the focussed cell and where to draw the triangle? Usually I would expect the DBGrid to keep these things in sync?
Nope. It's the dumbest feature of vanilla dbgrid IMHO and it lasts from the very beginning.
Do you know how this happens? What makes DBGrid do this?

Re: DisplayFormat and DBgrid

Posted: 29.07.2022, 08:35
by marsupilami
nlanger wrote: 28.07.2022, 15:51 Something is misaligned when setting "DisplayFormat". Does the ZQuery look for the first record where the format can be applied?
Even if it does, if TZQuery moves to another record, I would expect DBGrid to synchronize to it correctly.

Re: DisplayFormat and DBgrid

Posted: 29.07.2022, 08:51
by Fr0sT
marsupilami wrote: 29.07.2022, 08:33 Do you know how this happens? What makes DBGrid do this?
No, the described case is surprise for me, I'm just saying that for DBGrid it's normal to have dataset cursor and focused cell indicator non-synced