I have a simple test app, with one empty form, and a second containing a TButton. The button script is like this:-
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show();
end;
Form2
is auto-created at startup. There's no other code at all.
When I run the app, I can press the button and Form2
appears. I can reposition/resize Form2
on the primary monitor, and then close it. If I press the Form1
button again, Form2
correctly reappears in the position it was last at. All fine so far...
However, if I position Form2
onto a secondary monitor, close it, and then press the button, then Form2
appears back on the primary monitor!
I want the form to reappear on the monitor it was last on - how can I get this behaviour??
This is because the default value for the form's DefaultMonitor
property is dmActiveForm
.
Set Form2's DefaultMonitor
to dmDesktop
, and the problem is resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With