Modify default selected row behavior in TAdvStringGrid

I'm working on a project that uses TAdvStringGrid. When I set Options.goRowSelect to true, the grid by default selects the first row when I fill the grid.
Here's the problem: My grids work in a couple of modes, Single Select and Multi Select, based on external criteria. When I am in single select mode, the grid when filled automatically highlights the first row. I can change the default SelectionColor to match the grid background color, thereby effectively hiding the selection.
The goal is for a user to only see a row selection color when the user clicks on a row; otherwise the rows should remain "unselected" in terms of color.

Since we have implemented paging, and store selected row information outside of the grid properties, I need to maintain selections when ever the user navigates back and forth through the "pages" of the grid. So as a user navigates to a page that has a row that has been previously selected, I restore the selection via RowSelect.

This works well for the most part with multi select, but single select always seems to highlight the first row automatically, and yet does not set the selected row to be highlighted. This can be confusing to the user.

So what I need to do is take the stored selection info in Single Select mode, and restore it as the user navigates back and forth through pages, highlighting the selected row without the first row of each page defaulting to being highlighted.

Hope that's clear enough. :slight_smile:

Thanks in advance.

Think I might have solved it. By not toggling DisjunctRowSelect and DisjunctNoCtrl (leaving set to true!), but turning off HotmailRowSelect when in Single Select mode, that seems to solve the problem.
Thanks.

1 Like