2

How to move form if the BorderStyle is set to bsNONE for border style? in firemonkey MAC OS X

TLama
  • 75,147
  • 17
  • 214
  • 392
user1581036
  • 61
  • 1
  • 7

2 Answers2

1

Without the form header, you'll need to roll your own method for the user to move the form.

To move the form in code, you can set the form's Left and Top properties.

Ami
  • 1,244
  • 6
  • 14
0

There is how you do it in HD FireMonkey XE4 Desktop application:

var
Form1: TForm1;
isDraging: boolean;
X0, Y0: single;

implementation

{$R *.fmx}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  isDraging := True;
  X0 := X;
  Y0 := Y;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Single);
begin
  if isDraging then
  begin
    Form1.Left := Trunc(Form1.Left + X - X0);
    Form1.Top := Trunc(Form1.Top + Y - Y0);
  end;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  isDraging := False;
end;

Tested and works on Windows 7 and Mac OS X Lion.

Edijs Kolesnikovičs
  • 1,627
  • 3
  • 18
  • 34