I have user-friendliness in mind, so I'd like to intercept the position of each form I'm opening, to store and retrieve each time the same form is opened again.
Because I plan to port this for MAC, I decided to use FireMonkey.
Unfortunately, there is no event which is fired when a form is moved on the screen. I tried to intercept the message which should be fired when moving, but because nothing is happening, I think that Firemonkey forms do not work as VCL forms.
I'm using this declaration:
protected
procedure WndMethod(var Msg: TMessage); virtual;
and this method implementation
procedure TMYForm.WndMethod(var Msg : TMessage);
var
Handled: Boolean;
begin
// Assume we handle message
Handled := True;
case Msg.Msg of
WM_MOVE : begin
Edit_X.Text :='x - ' + MYForm.Left.ToString;
Edit_Y.Text :='y - ' + MYForm.Top.ToString;
end;
else
Handled := False;
end;
if Handled then
// We handled message - record in message result
Msg.Result := 0
else
// We didn't handle message
// pass to DefWindowProc and record result
Msg.Result := DefWindowProc(FHWnd, Msg.Msg,
Msg.WParam, Msg.LParam);
end;
I try to move the form on the screen, but no event is intercepted. I placed a breakpoint in the beginning of the method implementation, but nothing happens until I close the form. In this case, a message is intercepted.
What am I doing wrong?