View Issue Details

IDProjectCategoryView StatusLast Update
0015040LazarusLCLpublic2009-11-24 22:22
ReporterMartin Friebe Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Target Version1.0.0Fixed in Version0.9.29 (SVN) 
Summary0015040: Automatic Drack/Dock flashes a huge rectangle to screen-pos (0,0)
DescriptionWhen setting a component to DragMode=automatic and then starting to drag it => a rectangle (dock/drag type rect) will be drawn (for a split second only) from the component top/left to the screens top/left.
Additional InformationC:\lazarus_latest\lcl\include\dragobject.inc line 116

FDockRect.BottomRight is never initialized => it will be 0/0 => the top/left of the screen.

procedure TDragDockObject.InitDock(APosition: TPoint);
begin
  DragPos := APosition; //should have been done before
  Control.CalculateDockSizes;
  // mouse click offset from control TopLeft in screen coordinates
  FDockRect.TopLeft := Control.ClientToScreen(Point(0, 0));
  if Control.Width > 0 then
    FDockOffset.x := Round((APosition.x - FDockRect.Left) / Control.Width * Control.UndockWidth)
  else
    FDockOffset.X := 0;
  if Control.Height > 0 then
    FDockOffset.Y := Round((APosition.y - FDockRect.Top) / Control.Height * Control.UndockHeight)
  else
    FDockOffset.Y := 0;
  FEraseDockRect := Rect(MaxInt, 0, MaxInt, 0);
end;


--------------------
C:\lazarus_latest\lcl\include\dragmanager.inc
line 564
The above is being called from here.

procedure TDragManagerDefault.DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer);
//Start a drag operation
begin
  if FPerformer = nil then
  begin
    if AThreshold >= 0 then
      FThresholdValue := AThreshold
    else
      FThresholdValue := DragThreshold;
    FWaitForTreshold := not AImmediate;
    GetCursorPos(FStartPosition);

    case AControl.DragKind of
      dkDrag: FPerformer := TDragPerformer.Create(Self, AControl);
      dkDock: FPerformer := TDockPerformer.Create(Self, AControl);
    end;

    if AImmediate then
    begin
//
// DragStrart paint to Bottom/Righ = 0/0
//
      FPerformer.DragStarted(FStartPosition);
      DragMove(FStartPosition);
    end;
  end;
end;

Dragmove is *probably* correcting it. Not tested
TagsNo tags attached.
Fixed in Revision22688
LazTarget1.0
WidgetsetWin32/Win64
Attached Files

Activities

Hans-Peter Diettrich

2009-11-12 12:31

reporter   ~0032073

Perhaps the widgetset (or GDI) is so clever to sort the coordinates before painting the rectangle?

I never observed such a rectangle myself - what's your Windows version?

A possible solution: the DockRect coordinates are checked before drawing.

Martin Friebe

2009-11-12 17:05

manager   ~0032082

Vista.

This doesn't happen with the elastic site example.
Simple drop a panel on a form, and set the panel to DragMode=dmAutomatic / DrackKind = dkDock.

Paul Ishenin

2009-11-20 09:03

manager   ~0032308

Please test and close if ok.

Issue History

Date Modified Username Field Change
2009-11-09 23:45 Martin Friebe New Issue
2009-11-09 23:45 Martin Friebe LazTarget => -
2009-11-09 23:45 Martin Friebe Widgetset => Win32/Win64
2009-11-12 12:31 Hans-Peter Diettrich Note Added: 0032073
2009-11-12 17:05 Martin Friebe Note Added: 0032082
2009-11-18 23:16 Vincent Snijders LazTarget - => 1.0
2009-11-18 23:16 Vincent Snijders Status new => acknowledged
2009-11-18 23:16 Vincent Snijders Target Version => 1.0.0
2009-11-20 09:03 Paul Ishenin Fixed in Revision => 22688
2009-11-20 09:03 Paul Ishenin Status acknowledged => resolved
2009-11-20 09:03 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-11-20 09:03 Paul Ishenin Resolution open => fixed
2009-11-20 09:03 Paul Ishenin Assigned To => Paul Ishenin
2009-11-20 09:03 Paul Ishenin Note Added: 0032308
2009-11-24 22:22 Martin Friebe Status resolved => closed