TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: GARY WEINFURTHER
date: 1997-12-06 09:31:00
subject: Drag/drop bug in D3

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.