Board index » delphi » Stringgrid Mouse Click Question

Stringgrid Mouse Click Question

For a stringgrid, the Click event passes the row and column of the cell
where the click occurred.  Is there a way to calculate the row and
column of the cell from the X and Y coordinates passed by the MouseUp or
MouseDown events?

Thanks

 

Re:Stringgrid Mouse Click Question


On 10 Mar 2003, Jack Mason <jackma...@mindspring.com> wrote:

Quote
> For a stringgrid, the Click event passes the row and column of the cell
> where the click occurred.  Is there a way to calculate the row and
> column of the cell from the X and Y coordinates passed by the MouseUp or
> MouseDown events?

procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var ARow, ACol : integer;  
begin
  StringGrid1.MouseToCell(X, Y, ARow, ACol);
  Caption := Format('Row: %d, Col %d', [ARow, ACol]);
end;

--
-Mike

Re:Stringgrid Mouse Click Question


Thank you very much!

Other Threads