Sunday, June 2, 2013

XE4 dbGrid Still Buggy - Please Vote Up QC 98255

This weekend I installed XE4 Enterprise on my new (well new to me) Windows 7 machine. I ran the Getting Started sample project that comes with FireDAC and the first thing I did was click the column heading in the dbGrid and guess what . . . it still has that annoying "black left edge" bug I reported a couple years ago.

My request has gotten no votes. Please go to EMBT's Quality Central and vote up QC 98255.

Black Left Edge Appears When Clicking Column Heading

I don't think I'm being nit-picky about this annoying behavior. When I use programs that display data in a grid, my expectation is to be able to sort the data by clicking on the column heading. I want to build the same functionality into my grids.

I hate this black line that shows up when you click a dbGrid column heading. In my mind it's very unattractive and looks extremely unprofessional.

For the amount of money we pay EMBT for Delphi you would think they would fix this bug. You would think EMBT would want to put their best foot forward and give us die-hard Delphi users, an out of the box dbGrid worthy of the Delphi name.

Go vote for QC 98255 so this damn thing gets fixed.

Semper Fi
Gunny Mike

Update 06/04/2013 6:50 PM:

It turns out that the black line is intended functionality. It is used to indicate the new location where a column is being moved to. I wish that the black line would only show up when the column heading is being dragged and not just being click.

Update 09/22/2013 11:03AM:

The following was posted on the EMBT QC site:

Clinton Johnson at 6/2/2013 8:11:38 AM -
Also, as a work around, he can disable column moving by creating a proxy class to access TCustomGrid's protected items and removing goColMoving from it's Options property with code like:

And placing
  TMyCustomGrid(DBGrid1).Options := TMyCustomGrid(DBGrid1).Options-[goColMoving];

in the onFormCreate and after anywhere he modifies the grid's options.  Changing DBGrid1 for each unique instance, obviously.

This work-a-round works perfectly fine for me since I do not need the ability to move columns around. Just wanted to pass this on.


  1. The problem is that you are reporting the intended behaviour as a bug. I'm surprised they have not just closed the bug as resolved, will not change.

    The code that upsets you so is TCustomGrid.DrawMove, it represents the insertion point for column dragging. There are a few code injection routines that might help, but here is a hack that will help if you do not need column dragging:



    And in your form.Create, and anywhere you modify options on the dbgrid:

    TMyCustomGrid(DBGrid1).Options := TMyCustomGrid(DBGrid1).Options-[goColMoving];

    Assuming your TDBGrid is called DBGrid1.

  2. Apparently there is some confusion, if this behavior might be "as designed".
    I would agree though, that this black line is at least "odd".

    I also don't see any precedence (in common Windows apps) that would show this behavior, so I vote to accept that as a visualization bug.

    Olaf Monien

  3. @Olaf - I read the comments you and Clinton added to the QC. I did not understand that the intent of the black bar was to indicate the new location of a column that is in the process of being moved.

    If that is the intent, then I think a black bar indicator should only appear if both an onTitleClick event and onMouseMove event happen simultaneously. Perhaps this could be called an onTitleDrag or onColumnMoving event.

    EMBT could also give us the ability to choose our own column moving color.

  4. @Olaf - Ugly isn't really a bug. They could just as easily use the code to draw a little triangle indicator.

    And actually, XORing the screen with indicators like this is VERY old school for Windows and has lots of precedence (tho now everyone wants fancy rendered previews. I think that might be beyond EMBT's current skill pool, or perhaps being generous - their budget)

    Still, they could have made the code more flexible to allow better rendering. And yes, @Michael, maybe it should be reserved for once the column has started moving.

    Still, the TDBGrid is an AWEFUL component, and you should consider one of the many EXCELLENT third party dbGrids out there. DevExpress has my money, but there are other good ones out there from TMS and the like as well - considering how much they add to your project, it is a small investment for a LOT of time saved in adding functionality.

  5. I agree, that this line looks unprofessional, but unfortunately it's not a bug. Try to use TXDBGrid instead of TDBGrid.

  6. Sometimes order by one title click is not a hopeful behavior.
    There are some ways to order data. The best way depends on the situation: components, query size, etc.
    If you always want order by on title click using the same method, I suggest you to create a inherited class that set a default OnTitleClick event.It's easy and you need do it only one time.