0

I'm migrating my application from Delphi VCL Application to FMX and I'm stuck in this piece of code where I should drag Image1 beyond the edges of the Form, but the same code doesn't have the same effect on the FMX form. How could I adapt this code to Firemonkey.

I tried to use the same code that I already use in VCL but the image does not move beyond the edges of the form as it does in my previous application.

This is the code I use in VCL and what I'm trying to adapt in FMX

procedure Tfrmmain.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  if ssLeft in Shift then
  begin
    CanDragging:= True;
    StartDragPos:= ClientToScreen(PointF(X, Y));
  end;
end;

procedure Tfrmmain.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Single);
begin
  if CanDragging then
  begin
    Image1.Position.Point:= ScreenToClient(ClientToScreen(
    Image1.Position.Point + ClientToScreen(PointF(X, Y)) - StartDragPos));
  end;
end;

procedure Tfrmmain.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  CanDragging:= False;
end;

procedure Tfrmmain.MouseUpEvent(X, Y: Integer);
begin
  CanDragging:= False;
  StartDragPos:= Point(0, 0);
end;
0

1 Answer 1

0

I'm very new to Firemonkey and some things might go unnoticed. Soon after posting this question I decided to continue my research and found this question that seems to solve my problem. So little for a huge resolution for me.

Here is the solution I will use

AutoCapture

Not the answer you're looking for? Browse other questions tagged or ask your own question.