Selection issues with hotmailrowselect

Using a TDBAdvGrid with HotmailRowSelect=true.  I'm also filling the grid with a dataset and PageMode=false.

If I click on the checkbox it gets checked.  Clicking on it again it becomes unchecked.  However, clicking it again and again does nothing... it no longer toggles until I move to a different record.

Or, if I click on the row, it checks the checkbox and I can click it once to uncheck the checkbox, but like above, I cannot toggle the checkbox anymore unless I move to another record.

Also, clicking on a row checks the checkbox but does not cause the OnCheckBoxChange event to occur.

TDBAdvGrid version

I have retested this here with a default TDBAdvGrid on the form and the code:

procedure TForm1.FormCreate(Sender: TObject);
  dbadvgrid1.MouseActions.HotmailRowSelect := true;
  dbadvgrid1.PageMode := false;
  dbadvgrid1.DataSource := DataSource1;
  adotable1.Active := true;

and I could not see an issue to toggle the checkboxes in the first column.
As the checkbox for a row indicates row selection, it is normal that when the active row changes, the checkbox for the active row gets selected.

We saw the issue with OnCheckBoxChange and we've fixed this. The next update will address this.

It could mean that I have some setting that is somehow causing the problem.  I've uploaded a test sample that shows I cannot toggle a checkbox more than twice.  I'm using Delphi 10.2.3.

We checked this and it was grid.MouseActions.TouchScroll = true in combination with HotmailRowSelect that was causing this. We have fixed this, the next update will  address this.

Awesome, thanks.

New issue.  Using the example logic from ADOSelection demo, I pull data from the dataset based on which checkbox is checked, i.e. selected.

This works fine unless the grid has been sorted differently than the dataset order.  To illustrate:
B (dataset and grid row B is selected)

Click to sort descending ends up like this visually:
C (dataset row B is still selected but shows that grid row C is selected)

However, dataset record B is really still selected because the selected row is physical row 2 of the dataset, not the displayed row from the sorted grid.

What I think should happen is that if you have rows selected and you click to sort, then the checkboxes should sort also so that the logical mapping is the same as the physical mapping both visually and internally.

Is this a bug or is this something where I have to internally sort the dataset and not use the built-in sort?

I added indexes to my dataset and added code to the CanSort event, setting DoSort to false and selecting the index needed to sort the dataset which seems to resolve my issue.

However, I'd like to still show that header icon as to whether it is sorting ascending or descending on that column.  How do I get that back now that I'm doing the sorting?
Set grid.SortSettings.Column & grid.SortSettings.Directions from the OnCanSort event from where you do your dataset sorting.

procedure TForm1.DBAdvGrid1CanSort(Sender: TObject; ACol: Integer;
  var DoSort: Boolean);
   DoSort := false;

   DBAdvGrid1.SortSettings.Column := ACol;
   if DBAdvGrid1.SortSettings.Direction = sdAscending then
     DBAdvGrid1.SortSettings.Direction := sdDescending
     DBAdvGrid1.SortSettings.Direction := sdAscending

Worked perfectly, thanks!

There is still an issue with HotmailRowSelect after updating to TBAdvGrid

While it now triggers the OnCheckboxChange event when clicking the checkbox, the SelectedRowCount is not correctly represented.

I'll try to describe the scenario:
1. Clicked first row's checkbox, CheckboxChange event occurs but SelectedRowCount=0 but checkbox is checked.  SelectedRowCount was expected to be 1.
2. Click the same checkbox, CheckboxChange event occurs and now SelectedRowCount=1 and checkbox is now cleared.  SelectedRowCount expected to be 0.
3. Clicked the same checkbox, CheckboxChange event occurs and SelectedRowCount=0 and checkbox is checked just as in step 1.
4. Clicked the 2nd row's checkbox, CheckboxChange event occurs and SelectedRowCount=2, but only the first checkbox is checked, this 2nd one is not checked.  In this case, SelectedRowCount was expected to be 2 and is, but the checkbox states are not visually correct (only the first row's checkbox is checked, but both should be).

One other related issue.  Clicking the first row, the checkbox toggles the first time you click it.  However, if you first click a row other the row 1, the checkbox does not toggle the first time you click it.  It appears that when focus is changed to the grid, you had to have been clicking row one.  If focus changes because you click a row other than row one, the checkbox doesn't toggle properly that first time.  This is only on initial grid focus.

For example, I click a load grid button and focus is not yet on the grid.  I then click row three's checkbox... it does not toggle visually.  However, had I clicked row one's checkbox, it would toggle visually.

Hope this was all clear enough.

The OnCheckBoxChange event is triggered before the checkbox state & associated row selection state is updated. Please use the OnCheckBoxClick event if you want the event after all is internally fully processed.
We have seen the second issue with a checkbox not immediately responding when it is clicked in a fixed cell and have applied an improvement for this. The next update will have this improvement.

Thanks, that works better (forgot about that event).  Looking forward to your other fix to resolve the issue where clicking on the checkbox on a row other than the first row for the first time when the grid is not in focus yet (or so it seems).