- Timestamp:
- Jun 15, 2019, 12:53:13 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/DrawDlg.pas
r159 r168 16 16 constructor Create(AOwner: TComponent); override; 17 17 procedure SmartInvalidate; virtual; 18 private 19 MoveFormPos: TPoint; 20 MoveMousePos: TPoint; 21 MoveActive: Boolean; 18 22 protected 19 TitleHeight: integer;23 TitleHeight: Integer; 20 24 // defines area to grip the window for moving (from top) 21 25 procedure InitButtons; 22 26 procedure OnEraseBkgnd(var m: TMessage); message WM_ERASEBKGND; 23 27 procedure OnHitTest(var Msg: TMessage); message WM_NCHITTEST; 28 procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 29 override; 30 procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; 31 procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; 32 procedure MouseLeave; override; 24 33 end; 25 34 … … 98 107 end; 99 108 109 procedure TDrawDlg.MouseDown(Button: TMouseButton; Shift: TShiftState; X, 110 Y: Integer); 111 var 112 MousePosNew: TPoint; 113 begin 114 inherited; 115 {$IFDEF LINUX} 116 // 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; 124 {$ENDIF} 125 end; 126 127 procedure TDrawDlg.MouseMove(Shift: TShiftState; X, Y: Integer); 128 var 129 MousePos: TPoint; 130 begin 131 inherited; 132 if MoveActive then begin 133 MousePos := ClientToScreen(Point(X, Y)); 134 SetBounds(MoveFormPos.X + MousePos.X - MoveMousePos.X, 135 MoveFormPos.Y + MousePos.Y - MoveMousePos.Y, 136 Width, Height); 137 end; 138 end; 139 140 procedure TDrawDlg.MouseUp(Button: TMouseButton; Shift: TShiftState; X, 141 Y: Integer); 142 begin 143 MoveActive := False; 144 inherited; 145 end; 146 147 procedure TDrawDlg.MouseLeave; 148 begin 149 MoveActive := False; 150 inherited; 151 end; 152 100 153 procedure TDrawDlg.InitButtons; 101 154 var
Note:
See TracChangeset
for help on using the changeset viewer.