[Lazarus] String Grid MouseToCell seems inconsistent when deleted some columns

faber faber.cpu at gmail.com
Tue Sep 7 16:45:32 CEST 2010


2010/9/7 Lukasz Sokol <el.es.cr at gmail.com>:
> procedure TForm1.StringGrid1Click(Sender: TObject);
> var gridcell : TPoint;
> begin
>  gridcell := StringGrid1.MouseToCell(Mouse.CursorPos);
>
>  StringGrid1.Cells[gridcell.x,0] := IntToStr(gridcell.x);
>  {what text do you get in fixed row of the visible column you've just clicked ?}
>  {my project got 0, 2, 4, 6, 8 }
>  {and I want 0,1,2,3,4 actually}
> end;

try with StringGrid1.MouseToCell(ScreenToClient(Mouse.CursorPos))
or better use X,Y with OnMouseDown:
  StringGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift:
TShiftState; X, Y: Integer);



best regards
faber




More information about the Lazarus mailing list