2
votes

I have a form which I'm painting on (OnPaint). I give the user grips to click on and change the shape. However, I would like to allow the user to move past the edge of the form. How can I get the mouse moments when the mouse goes past the edge. I know this can be done because it works on a TrackBar. And while that is a Component and not a Form, I assume I can change the forms style or register something to make it act in a similar manor.

I plan on making the form background transparent so ideally, the same solution would allow me to get mousemoves over the transparent areas.

1

1 Answers

2
votes

FMX uses the AutoCapture property for that. Then the mouse will be captured while the mouse button is down.

constructor TMyGrip.Create(AOwner: TComponent);
begin
  inherited;

  AutoCapture := True;
  CanFocus := True;
end;

This does not work for a form. But you could add a TLayout on the form that fills the entire client.

FMX internally uses FWinService.SetCapture(Self); and FWinService.ReleaseCapture(Self); for this, and this accepts a form. I haven't tested this, but it could happen that you'll confuse the FMX framework quite a bit if you call the internal functions like that.