【问题标题】:FMX TStringGrid set selected cellFMX TStringGrid 设置选定单元格
【发布时间】:2022-01-10 08:27:13
【问题描述】:

我需要在 FMX TStringGrid 中进行单元格跳转。之前,我在 VCL 应用程序中使用此代码:

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

那么,我该如何在 FMX 中做到这一点?

【问题讨论】:

  • 发送tour 并了解如何不让您的问题显得那么草率(换行符和缺少格式)。您可能想要添加the tag "TStringGrid"。逗号而不是正确的标点符号也可以极大地改变意义。

标签: delphi firemonkey delphi-10.3-rio tstringgrid


【解决方案1】:

如果您在 FMX 中尝试了相同的代码,您可能会被 FMX 不会自动指示选择的事实所误导。您需要将焦点设置到网格上才能查看选择了哪个单元格:

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

您也可以选择一个单元格

StringGrid1.SelectCell(1, 2); // col, row
StringGrid1.SetFocus;

【讨论】:

    【解决方案2】:

    完全相同相同的代码也应该在 FMX 中工作,因为 FMX 的 TStringGrid 具有可写的 RowCol 属性,就像 VCL 的 TStringGrid 一样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-10
      • 1970-01-01
      • 2015-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多