【发布时间】:2019-09-01 16:00:23
【问题描述】:
我正在尝试在每个单元格的 TStringGrid 控件上显示工具提示。目的是在单元格的内容不适合单元格时显示工具提示。现在我什至无法让工具提示显示鼠标悬停的单元格的正确内容。
到目前为止,我尝试的是使用 Application.hint 和 MyGrid.Hint 并将其设置为单元格的内容。看起来它总是在提示触发前半秒左右获取光标下单元格的内容。
甚至尝试设置 mousemove 事件并像这样设置工具提示:
procedure TForm1.GridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);
var
Row : Integer;
Column: TColumn;
Col : Integer;
sHint : string;
begin
Row := ProcessGrid.RowByPoint(X,Y);
Column := ProcessGrid.ColumnByPoint(X,Y);
if Assigned(Column) then
Col := Column.Index
else
Col := -1;
if (Row>-1) and (Col>-1) then
begin
sHint := ProcessGrid.Cells[Col,Row];
// Application.Hint := sHint;
ProcessGrid.Hint := sHint;
end;
Caption := Format('Col:%d Row:%d Hint: %s', [Col, Row, sHint]);
end;
上述代码表单中的标题显示了正确的单元格内容。然而,提示没有,我无法理解原因。一定是我忽略了一些简单的事情。
使用 Delphi 10.3.2 并尝试让它在 macOS 上运行。
【问题讨论】:
标签: macos delphi firemonkey