FNC TableView: Position / ScrollToItem

Hello and merry Christmas,

I have a Tableview which is filled repeatedly depending on a certain input. If I scroll the tableview prior to the next clear/fill cycle the tableview does not move to the first item /top of the table view but remains at the previous position. I tried ScrollToItem(0) but this does not help.

How can I change this behaviour?

I have retested this here with the code:


procedure TForm2.Button1Click(Sender: TObject);
var
  i: integer;
begin
  TMSFNCTableView1.Items.Clear;
  for i := 0 to 50 do
  begin
    TMSFNCTableView1.Items.Add.Text := 'item '+inttostr(i);
  end;
end;

and regardless of the scroll position, the refill of items this way always makes the TTMSFNCTableView scroll back to top position. What are you doing different?

I have two categories and the categories are set to custom - those are the only changes I recall


I will also give it a try here (I used Rio and latest FNC version)

I did some further tests. It occurs if you wrap the code in a BeginUpdate / EndUpdate

When BeginUpdate/EndUpdate is used, it persists the scroll position, but testing it here with:


procedure TForm2.Button1Click(Sender: TObject);
var
  i: integer;
begin
  TMSFNCTableView1.BeginUpdate;
  TMSFNCTableView1.Items.Clear;
  for i := 0 to 50 do
  begin
    TMSFNCTableView1.Items.Add.Text := 'item '+inttostr(i);
  end;
  TMSFNCTableView1.EndUpdate;
  TMSFNCTableView1.ScrollToItem(0);
end;

scrolls back as expected to the first item

True, my error was to put the ScrollToItem in the BeginUpdate/EndUpdate block