Can't select row when TDBAdvGrid has 1 record

I have a TDBAdvGrid (v2.3.6.24) in my application. Prior grid versions worked until this version well. Options are [goRangeSelect, goRowSelect] and ShowSelection is  False. When there are more then one record showing, it works normal. I can select a row (or more rows) and the OnSelectionChanged event is fired. When there is only one record, nothing happens. No OnSelectionChanged event is fired. Clicking on the leftmost header cell and then on the row with the record it gets selected and the event is fired.


If I set ShowSelection to True, is shows the row selected (which isn't) and Rowselectcount = 0.

What is changed in this version of TDBAdvGrid ??

OnSelectionChanged is triggered when the selection changes. When there is only one row in the grid and you have row selection enabled (goRowSelect), the selected row can't change, hence OnSelectionChanged is not triggered.
RowSelectCount is used when disjunct row selection is enabled. If you have no disjunt row selection, the selected row(s) are indicated by grid.Selection.Top -> grid.Selection.Bottom

When the grid is showed for the first time (with disjunct row selection enabled) there is nothing selected (ie. RowSelectCount=0) but there is one record selected which can't be changed ??? Seems to me a bug.

Why did it work then in the previous versions ? I showed my users a grid with records (showselection=false initial), they click on a row and OnSelectionChanged get fired and in that event I enable some buttons which can do some work on the selected row(s) and ShowSelection=True. Now it isn't possible anymore. 

It is a bug, TDBGrid and other grids don't have this problem, only the latest TAdvDBGrid. Please repeair it !

It is not because ShowSelection = false initially that there isn't a row selected. ShowSelection just controls whether the selected row is displayed in a different color.

The selected row is indicated by grid.Row: integer and when the grid has 1 record, this is set to 1. When you click it, it remains 1, so there is no reason for OnSelectionChanged to be triggered. If it did so in the past, it was incorrect behavior in the past. 
If you use disjunct row selection, when you need to use to be notified when a a disjunct row selection happens is the event OnRowDisjunctSelect. This event will be triggered when an unselected row is clicked and from there you can toggle grid.ShowSelection.

I have tried to use your advise but no luck. I have use your ADO DBAdvGrid Selection example as base and set the grid as you said. Just clicking on a row sets de DB indicator to that row, no selection showed up. Clicking a second time on that row shows the whole row selected. SelectedRowCount stays at zero. Clicking a second row when holding down CTRL select that row and leaves the first row untouched. Both rows are now showing selected but SelectedRowCount is 1 (not 2 as I expected) I am really stuck with it !! 


All I want is the same behaviour as before and like TDBGrid does.

The intention of the ADOSelection demo is to demonstrate disjunct selection through the checkbox column. To see disjunct selection without checkboxes, please set grid.PageMode = false and set grid.MouseActions.DisjunctRowSelect = true.

Send you the ADO selection example I have used to demonstrate the problem. It has a DBadvGrid and a DBGrid with rowselection enabled. When I select for example 3 rows, DBAdvGrid shows always one less, ie. 2 rows. DBGrid shows the correct rowselect count, ie. 3 rows. As said before, it is a bug.

We will investigate.

It turned out to be a mistake in your code.

The updated SelectedRowCount is to be retrieved from OnRowDisjunctSelected,
OnRowDisjunctSelect is triggered before the disjunct select is completed and its purpose is to allow to block the selection of a specific row and as such, it is normal that SelectedRowCount is not yet the new value.