Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TStringGrid - moving rows

Status
Not open for further replies.

martinm

IS-IT--Management
Mar 30, 2001
113
0
0
GB
I'm trying to move rows around. I have goRowMoving = True.

I can't find any method to do the move, so am using drag/drop.

Manual drag mode.

However, when dropping the row, I get exception 'Cannot insert or delete rows from grid'

Also, how do I get the 'Drop' row number?


// This drops it in Row 0
procedure TForm1.grdSourceListDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
grdSourceList. Rows[FintDragRow].Move(FintDragRow,0);
end;

procedure TForm1.grdSourceListMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
grdSourceList.BeginDrag(False, 4);
end;

// Get the row I'm moving
procedure TForm1.grdSourceListStartDrag(Sender: TObject;
var DragObject: TDragObject);
begin
FintDragRow := grdSourceList.Row;
end;

Ta.
 
Sorted - you must have a FixedCol value > 0 it appears.

Then it does it all for you (as expected).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top