Changeset 617 for trunk/Packages/CevoComponents
- Timestamp:
- Sep 15, 2024, 1:31:30 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/DrawDlg.pas
r565 r617 25 25 procedure InitButtons; 26 26 procedure OnEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND; 27 procedure OnHitTest(var Msg: TMessage); message WM_NCHITTEST;28 27 procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 29 28 override; … … 92 91 end; 93 92 94 procedure TDrawDlg.OnHitTest(var Msg: TMessage);95 var96 I: integer;97 ControlBounds: TRect;98 Pos: TPoint;99 begin100 if BorderStyle <> TBorderStyle.bsNone then101 inherited102 else103 begin104 Pos := Point(ScaleFromNative(Integer(Msg.LParam and $ffff)),105 ScaleFromNative(Integer((Msg.LParam shr 16) and $ffff)));106 if Pos.Y >= Top + TitleHeight then107 Msg.Result := HTCLIENT108 else109 begin110 for I := 0 to ControlCount - 1 do111 if Controls[I].Visible then112 begin113 ControlBounds := Controls[I].BoundsRect;114 if (Pos.X >= Left + ControlBounds.Left) and115 (Pos.X < Left + ControlBounds.Right) and116 (Pos.Y >= Top + ControlBounds.Top) and117 (Pos.Y < Top + ControlBounds.Bottom) then118 begin119 Msg.result := HTCLIENT;120 Exit;121 end;122 end;123 Msg.Result := HTCAPTION;124 end;125 end;126 end;127 128 93 procedure TDrawDlg.MouseDown(Button: TMouseButton; Shift: TShiftState; X, 129 94 Y: Integer); … … 131 96 MousePos1: TPoint; 132 97 MousePos2: TPoint; 133 {$IFDEF UNIX}134 98 NewFormPos: TPoint; 135 {$ENDIF}136 99 begin 137 100 MousePos1 := Mouse.CursorPos; 138 101 inherited; 139 102 MousePos2 := Mouse.CursorPos; 140 {$IFDEF UNIX}141 // Only if client is not doing own mouse move handling142 103 if not Assigned(OnMouseDown) or not Assigned(OnMouseMove) or not Assigned(OnMouseUp) then begin 143 // HitTest is not supported under Linux GTK2 so use form inside move mechanizm144 104 NewFormPos := ScreenToClient(Mouse.CursorPos); 145 105 if (NewFormPos.X >= 0) and (NewFormPos.X < Width) and … … 154 114 end else MoveActive := False; 155 115 end; 156 {$ENDIF}157 116 end; 158 117 … … 163 122 inherited; 164 123 if MoveActive then begin 165 MousePos := ClientToScreen(Point(X, Y));124 MousePos := Mouse.CursorPos; 166 125 SetBounds(MoveFormPos.X + MousePos.X - MoveMousePos.X, 167 MoveFormPos.Y + MousePos.Y - MoveMousePos.Y, 168 Width, Height); 126 MoveFormPos.Y + MousePos.Y - MoveMousePos.Y, Width, Height); 169 127 end; 170 128 end;
Note:
See TracChangeset
for help on using the changeset viewer.