Ignore:
Timestamp:
Jun 16, 2019, 11:29:21 AM (5 years ago)
Author:
chronos
Message:
  • Fixed: Disable MoveAction for TDrawDlg instances after visible change.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r168 r174  
    1515  public
    1616    constructor Create(AOwner: TComponent); override;
     17    destructor Destroy; override;
    1718    procedure SmartInvalidate; virtual;
    1819  private
     
    2021    MoveMousePos: TPoint;
    2122    MoveActive: Boolean;
     23    procedure VisibleChangedHandler(Sender: TObject);
    2224  protected
    2325    TitleHeight: Integer;
     
    6769  inherited;
    6870  TitleHeight := 0;
     71  MoveActive := False;
     72  AddHandlerOnVisibleChanged(VisibleChangedHandler);
     73end;
     74
     75destructor TDrawDlg.Destroy;
     76begin
     77  RemoveHandlerOnVisibleChanging(VisibleChangedHandler);
     78  inherited Destroy;
    6979end;
    7080
     
    111121var
    112122  MousePosNew: TPoint;
     123  NewFormPos: TPoint;
    113124begin
    114125  inherited;
    115126  {$IFDEF LINUX}
    116127  // HitTest is not supported under Linux GTK2 so use form inside move mechanizm
    117   MoveMousePos := ClientToScreen(Point(X, Y));
    118   MoveFormPos := Point(Left, Top);
    119   MousePosNew := Mouse.CursorPos;
    120   // Activate move only if mouse position was not changed during inherited call
    121   if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
    122     MoveActive := True;
    123   end;
     128  NewFormPos := ScreenToClient(Mouse.CursorPos);
     129  if (NewFormPos.X >= 0) and (NewFormPos.X < Width) and
     130    (NewFormPos.Y >= 0) and (NewFormPos.Y < Height) then begin
     131    MoveMousePos := ClientToScreen(Point(X, Y));
     132    MoveFormPos := Point(Left, Top);
     133    MousePosNew := Mouse.CursorPos;
     134    // Activate move only if mouse position was not changed during inherited call
     135    if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
     136      MoveActive := True;
     137    end;
     138  end else MoveActive := False;
    124139  {$ENDIF}
    125140end;
     
    149164  MoveActive := False;
    150165  inherited;
     166end;
     167
     168procedure TDrawDlg.VisibleChangedHandler(Sender: TObject);
     169begin
     170  MoveActive := False;
    151171end;
    152172
Note: See TracChangeset for help on using the changeset viewer.