Subject Grid Multiselection
Author paulhope@allcomm.co.uk
I have been playing around with multirow selection in the ib_grid and
haven't found the behaviour I was hoping for.

2 problems . .

1. If a selection is set in code and includes an already set row
then an invalid row number error is created. This is a nuisance - I
have managed to find the offending code in IBA_BDataset.IMP line 2563
(V3.6)

if ( rfSelected in RowFlags ) <> AValue then
begin
if AValue then
RowFlags := RowFlags + [ rfSelected ]
else
RowFlags := RowFlags - [ rfSelected ];
ProcessLinkEvent( setSelectedChanged, ARowNum );
ABookmark := BinaryToHexText( KeyData, KeyDataLength );
if Assigned( FOnRowSelectedChanged ) then
FOnRowSelectedChanged( Self, ARowNum, ABookmark, AValue );
end
else
raise EIB_DatasetError.Create( E_Invalid_RowNum );

I think this could be changed to

if AValue and not( rfSelected in RowFlags )then
RowFlags := RowFlags + [ rfSelected ]
else
if ( rfSelected in RowFlags )then
RowFlags := RowFlags - [ rfSelected ];
ProcessLinkEvent( setSelectedChanged, ARowNum );
ABookmark := BinaryToHexText( KeyData, KeyDataLength );
if Assigned( FOnRowSelectedChanged ) then
FOnRowSelectedChanged( Self, ARowNum, ABookmark, AValue );

This would just ignore any previous setting

2. The range selection always works from the indicated row to the
one just Shift-Clicked. This is fine if the whole range is visible,
but if the grid is scrolled the indicated row changes and the
intended start row is lost.

In order to be consistent with Windows multiselection it should be
possible to click on the first row, scroll to somewhere else and
Shift_Click to make the selection ( including rows that have scrolled
out of sight).

I can't see how this part works in the source code. But it should be
possible to select all rows from that last selected row to the one
Shift-Clicked. Also using the keys shift-arrowUp/Down or
PageUp/Down should select rows.

Any interest in sorting this?

Regards
Paul