mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:19:18 +02:00
- fixing AV during Drag and Drop operation
- looking on non TWinControl objects while drop (0008628) git-svn-id: trunk@10914 -
This commit is contained in:
parent
b8727ab740
commit
fd45a904f4
@ -245,10 +245,12 @@ Begin
|
|||||||
{$IFDEF VerboseDrag}
|
{$IFDEF VerboseDrag}
|
||||||
DebugLn('DragTo P=',Position.X,',',Position.Y);
|
DebugLn('DragTo P=',Position.X,',',Position.Y);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (ActiveDrag = dopNone)
|
if (DragControl = nil) or ((ActiveDrag = dopNone) and
|
||||||
and (Abs(DragStartPos.X - Position.X) < DragThreshold)
|
(Abs(DragStartPos.X - Position.X) < DragThreshold) and
|
||||||
and (Abs(DragStartPos.Y - Position.Y) < DragThreshold) then begin
|
(Abs(DragStartPos.Y - Position.Y) < DragThreshold)) then
|
||||||
|
begin
|
||||||
// dragging not yet started
|
// dragging not yet started
|
||||||
|
// or CancelDrag happened (DragControl = nil)
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -72,8 +72,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDragObject.CaptureChanged(OldCaptureControl: TControl);
|
procedure TDragObject.CaptureChanged(OldCaptureControl: TControl);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
IsDragging: Boolean;
|
||||||
begin
|
begin
|
||||||
DragDone(OldCaptureControl.Dragging);
|
// if this is TWinControl, and it have controls (not TWinControls)
|
||||||
|
// then we should check Dragging in those controls
|
||||||
|
IsDragging := OldCaptureControl.Dragging;
|
||||||
|
if (not IsDragging) and (OldCaptureControl is TWinControl) then
|
||||||
|
begin
|
||||||
|
for i := 0 to TWinControl(OldCaptureControl).ControlCount - 1 do
|
||||||
|
begin
|
||||||
|
IsDragging := IsDragging or TWinControl(OldCaptureControl).Controls[i].Dragging;
|
||||||
|
if IsDragging then
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
DragDone(IsDragging);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDragObject.KeyDown(var Key: Word; Shift: TShiftState);
|
procedure TDragObject.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
|
Loading…
Reference in New Issue
Block a user