I've been trying to implement drag and drop in Delphi 3.02 using the
right mouse button. I found I could initiate the drag and drop by
calling BeginDrag(False) in the OnMouseDown event. This worked fine,
except that the drag would not end when the mouse button was released.
A good friend came up with the solution. In CONTROLS.PAS,
the TDragObject.MouseMsg method only reacts to the left mouse button.
The fix is as follows:
procedure TDragObject.MouseMsg(var Msg: TMessage);
var
P: TPoint;
begin
try
case Msg.Msg of
WM_MOUSEMOVE:
begin
P := SmallPointToPoint(TWMMouse(Msg).Pos);
ClientToScreen(DragCapture, P);
DragTo(P);
end;
WM_LBUTTONUP, WM_RBUTTONUP: // Added WM_RBUTTONUP
DragDone(True); // GBW, 12/6/97
end;
except
if DragControl nil then DragDone(False);
raise;
end;
end;
In my next message, I'll describe how to properly update the Delphi source
code.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI, USA. (1:2410/905)
|