[SOLVED]Stringgrid and mouse pointer lazarus / 31-LCL ---------------------------------------------------------------------- Fai · 2017-08-08 03:34 Hi, This is my code on StringGrid OnMouseUp event: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);var  ACol, ARow: integer;begin  with (Sender as TStringGrid) do begin    MouseToCell(X, Y, ACol, ARow);    if (ACol = 1) and (ARow>=FixedRows) then begin      ShowMessage('Click');    end;  end;end; If I click on the non grid area the event still fired as long as the mouse pointer inline with column 1 (see picture). How can I prevent this? so the event fired only when the mouse pointer clicked on top of the grid cell area. ---------------------------------------------------------------------- Handoko · 2017-08-08 04:03 Add CellRect to make sure the mouse pointer is inside the cell: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);var  ACol, ARow: Integer;  ARect: TRect;begin  with (Sender as TStringGrid) do begin    MouseToCell(X, Y, ACol, ARow);    ARect := CellRect(ACol, ARow);    if (Y > ARect.Bottom) then Exit;    if (ACol = 1) and (ARow>=FixedRows) then begin      ShowMessage('Click');    end;  end;end; ---------------------------------------------------------------------- Fai · 2017-08-08 04:30 Thanks Handoko, it works.