-1

I need to do a cell jump in an FMX TStringGrid. Before, I did it in a VCL application using this code:

StringGrid.Row := StringGrid.Row + 1;
StringGrid.Col := 1;

So, how do I do that in FMX?

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
  • 1
    Take a [tour] and find out how to not make your question appear that sloppy (linebreaks and missing formatting). You might want to add [the tag "TStringGrid"](https://stackoverflow.com/questions/tagged/tstringgrid). Also commas instead of correct punctuation can change the sense drastically. – AmigoJack Dec 04 '21 at 05:50

2 Answers2

2

If you tried the same code in FMX, you might have been misguided by the fact that FMX doesn't indicate the selection automatically. You need to set the focus to the grid to see which cell is selected:

StringGrid1.Row := StringGrid1.Row+1;
StringGrid1.Col := 1;
StringGrid1.SetFocus;

Alternatively you can select a cell also with

StringGrid1.SelectCell(1, 2); // col, row
StringGrid1.SetFocus;
Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
0

The exact same code should work in FMX too, as FMX's TStringGrid has writable Row and Col properties, just like VCL's TStringGrid has.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770