Hint on TStringGrid in Delphi XE10

LeTay
LeTay used Ask the Experts™
on
I am programming with Delphi XE 10.1 Berlin
Is it possible that the "hint" text defined on a TStringGrid when it becomes visible, has different texts if the mouse is over one cell or another ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior developer, analyst and customer assistance
Commented:
A very simple sample
var
  Form1: TForm1;
  Col: Integer;
  Row: Integer;

implementation

{$R *.dfm}

procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  r: Integer;
  c: Integer;
begin
  StringGrid1.MouseToCell(X, Y, c, r);
  if ((Row <> r) or (Col <> c)) then
  begin
    Row := r;
    Col := c;
    Application.CancelHint;
    StringGrid1.Hint := IntToStr(r) + #32 + IntToStr(c);
  end;
end;

Open in new window

Author

Commented:
Thanks, will try that ASAP
What is the role of the declared Col and Row (outside the procedure) ?
Ferruccio AccalaiSenior developer, analyst and customer assistance

Commented:
Col and Row are declared as global to save the last onmouse over cell  and check if the new one selected is different

Author

Commented:
Col and Row, of course, avoiding to set hint if the same

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial