TAdvDbGrid cell color works fine on screen, but in PDF output a different column is targeted

Thanks. I saw that in the list of changes.

On another note regarding column "ACol" referencing in various TAdvStringGrid and TAdvDbGrids. When the grid has hidden columns, the events that I see issues with are:

  • OnCanClickCell
  • OnClickCell
  • OnGetCellCursor

If the hosted grid has hidden columns, then the ACol value passed into the functions are incorrect, and I've always had to manually adjust them in my code. (i.e., if I know there is a column to the left of the clicked cell is hidden, I need to increment the ACol value by one before I see which column was actually clicked. Here's an example:

procedure TMyMainForm.myDbGridCanClickCell(Sender: TObject; ARow, ACol: Integer; var Allow: Boolean);
var colTitle : string;
begin
  // Adjust ACol value to account for known hidden columns.  For this grid, we know that
  // the first two columns are hidden.  So, we have to adjust ACol before seeing what
  // colTitle we're dealing with...
  Inc( ACol, 2 );  // skip over the first 2 columns which are always hidden

  colTitle := myDbGrid.Cells[ ACol, 0 ];
  Allow := (colTitle='Team') or (colTitle='Player');
end;

The above code sample is for the OnCanClickCell event, but I need to apply the same adjustments for the OnClickCell and OnGetCellCursor events.

I tried adjusting the ACol value with some of the utility functions available, named something named like getRealCol or getDisplayCol (sorry I don't have the exact names at this moment) but those don't provide the expected column value.

The issue gets a bit more complex if other columns can be hidden on the fly (as I have demonstrated in my PDF color test program that I posted above).

If you'd like me to post this in a new topic, let me know. I can also provide another test program like I did for the PDF color test and post the source for you to compile. I'm happy to assist wherever possible.

Thanks,

Steve