size : 826
uploaded_on : Thu Oct 15 00:00:00 1998
modified_on : Wed Dec 8 14:03:20 1999
title : Right mouse button drag-and-drop
org_filename : RightMouseDND.txt
author : Tom Stechow
authoremail :
description : How to drag-and-drop with the right mouse button
keywords :
tested : not tested yet
submitted_by : Mike Orriss
submitted_by_email : mjo@3kcc.co.uk
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : plain
file-type : text/plain
category : delphi-misc
__END_OF_HEADER__
I'm trying to implement drag 'n drop using both mouse buttons. Right mouse
will bring up a context menu of "what do you want to do", as in Explorer. I can't get it to work with the right button!
This is a guess, but I think this is what is causing your problem. The
procedure is from controls.pas.
I'm guessing that adding WM_RBUTTONUP do the case statement will do it.
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: <--- Try adding WM_RBUTTONUP here.
DragDone(True);
end;
except
if DragControl <> nil then DragDone(False);
raise;
end;
end;
Tom Stechow