unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Grids;
type
{ TForm1 }
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
public
end;
var
Form1: TForm1;
ReadyRow: Integer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var aPt: TPoint;
begin
aPt:=StringGrid1.MouseToCell(Point(X, Y));
if aPt.X=0 then
begin
writeln('From', aPt.Y);
ReadyRow:=aPt.Y;
end else
ReadyRow:=-1;
end;
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var aPt: TPoint;
begin
aPt:=StringGrid1.MouseToCell(Point(X, Y));
if (aPt.X=0) and (ReadyRow>0) then
begin
writeln('To', aPt.Y);
StringGrid1.MoveColRow(False, ReadyRow, aPt.Y);
end;
ReadyRow:=-1;
end;
end.