|
Reported by Steve Bliss; checked by Reinier Sterkenburg
The bug has been verified in Delphi versions 3.01 through 5.01.
I have not looked if other components have the bug, so
TImage may not be the only one. I have submitted a report to Borland.
To reproduce:
Make a form with two TImages (Image1 and Image2) setup to drag and
drop from 1 to 2 like this:
----------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Image2: TImage;
procedure Image1MouseDown( Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1DragOver( Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure Image1EndDrag( Sender, Target: TObject; X, Y: Integer);
procedure Image2DragOver( Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Image2DragOver( Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept:
Boolean);
begin
Accept := (Source=Image1)
end;
procedure TForm1.Image1MouseDown( Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft then
Image1.BeginDrag( true)
end;
procedure TForm1.Image1DragOver( Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept:
Boolean);
begin
Accept := (Sender=Source)
end;
procedure TForm1.Image1EndDrag( Sender, Target: TObject; X, Y: Integer);
begin
raise Exception.Create('Drop Exception')
end;
end.
If you run the program and drag and drop on one of the images,
the exception that occurs in the EndDrag handler will cause an Access
Violation when run from the IDE, or show the correct Exception and then
terminate the app if run as a standalone exe. |