ItemIndex and SelectItem and TTMSFNCTableView


We are trying to select an item of  TTMSFNCTableView in code, but neither ItemIndex nor SelectItem() seems to work. The only way to select an item is to click on it with the mouse.

The problem seems to be in FMX.TMSFNCTableView in the function GetRowForItemIndex() where the loop boundary FDisplayList.Count is always 0.

Very best regards,

Olivier Beltrami

I cannot see a problem here. I have retested this here with a default TTMSFNCTableView on the form and added the code:

procedure TForm2.Button1Click(Sender: TObject);
   TMSFNCTableView1.ItemIndex := 2;

and this updates the expected selected item.

Finally found the problem ...

ItemIndex does not work insode a BeginUpdate/EndUpdate block.
We moved it out of the block and now it works.
Might be documented somewhere but did not see it.

Yes, it needs to be set outside BeginUpdate/EndUpdate.
We will try to make this more clear.