ActiveRow in TTIWAdvWebGrid

Hi,


I have a grid set up as detailed below. The problem I am having with it is that when a row is clicked to make it the active row the grid immediately scrolls so that the newly active row is at the bottom. How can I stop the grid from scrolling like this? When I click on a row I want it become highlighted (as it does) but I want to stay in the same position rather than jumping to the bottom.

To see this in action do the following:

Place a TIWRegion on the form and a TTIWAdvWebGrid inside it. Size the grid so it just fits in the region.

Add the following FormCreate procedure:


procedure TIWForm1.IWAppFormCreate(Sender: TObject);
var
  i: Integer;
  iRow: Integer;
begin
  Grid1.UseFullHeight := True;
  Grid1.UseFullWidth := True;
  Grid1.Scroll.Style := scNever;


  Grid1.ClearCells;
  Grid1.TotalRows := 0;
  Grid1.MouseSelect := msMove;
  Grid1.Scroll.Style := scAuto;
  Grid1.AsyncActiveRowMove := True;
  Grid1.ActiveRowColor := $00C000;


  //add some dummy data
  iRow := 0;
  for I := 0 to 50 do
  begin
    Grid1.TotalRows := Grid1.TotalRows + 1;
    Grid1.Cells[0, iRow] := IntToStr(I);
    Grid1.Cells[1, iRow] := IntToStr(I);
    Grid1.Cells[2, iRow] := IntToStr(I);
    Inc(iRow);
  end;
  Grid1.RowCount := Grid1.TotalRows;
end;


Hi,


Can you please try to set the Scroll.ScrollIntoView property to False to disable the unwanted behavior?
This property is intended to automatically scroll a programmatically selected row into view.

Thank you Bart, that's perfect.

Just been thinking about that some more. The ScrollIntoView is very useful but can I suggest the following modifications:


If the active row is already visible then the grid doesn't scroll (ie clicking on a row in the grid highlights it and leaves it in the same place).

If the active row is not already visible then scroll the grid so that it is in the middle, not at the bottom.

Hi,


Thank you for your suggestions.
I'll add them to the feature-request list and we'll investigate if these improvements can be added in a future version of the TIWAdvWebGrid.