TDBAdvGrid with highlight on click, not select!

Hi there,

I have a tDBAdvGrid:

  • Pagemode: = true;
  • AutoHideSelection: = false;
  • ShowSelection: = true;

I would now like to select a line via DblClick, then scroll through the other lines without deselecting.
Then only use DblClick to define another line as a selection.

Ideally with a visual display: Selection as usual in blue, line of the cursor with light blue.

My only consideration so far has been to set PageMode = false and to do the drawing and synchronizing via events.

Is this also possible by any attributes?

Regards

The selected row in the grid normally indicates the active record. When the grid has PageMode = true, it will only have and show the rows from the buffer of visible rows in the dataset. As one scrolls through the dataset, it is expected that the active record is within the set of visible records. That means that normally this active record, i.e. selected row will always be within the visible rows.
With PageMode = false, this does not happen because the grid preloads all records at once.
A possible alternative to indicate selected rows in grid.PageMode = true is with the technique that is demonstrated in the demo Demo\DBAdvGrid\ADOSelection

Thanks for the answer.

My solution for now is the following:

  1. Set the grid.ActiveCellColor to a clNone
  2. Save the double-clicked line-nr with a global variable
  3. Check in OnGetCellColor whether this is the double-clicked line
    Yes: ABrush.Color := (primary HighlightColor)
    No: ABush.Color := (secondary HighlightColor)

Saving the grid as global Variable, allows me to set the primary row between multiple Grids as well:

   if (TDBAdvGrid (Sender) = aActiveFilterGrid) AND (ARow = iActiveFilterRow) then
     ABrush.Color: = $ 00D1B9A5
   else if (aRow = TDBAdvGrid (Sender) .row) then
     ABrush.Color: = clGradientInactiveCaption;

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.