I have created a custom form to display an options page, which I am trying to position in the centre of wherever the WizardForm
is at the time an Options button is clicked. I have tried the following code, but it is not positioning it as described.
[Code]
var
OptionsWindowForm: TForm;
{ Show the Options window }
procedure ShowOptionsWindow;
begin
OptionsWindowForm := TForm.Create(nil);
with OptionsWindowForm do
begin
Parent := WizardForm;
BorderStyle := bsDialog;
Position := poMainFormCenter;
ClientWidth := ScaleX(400);
ClientHeight := ScaleY(140);
Caption := '{#AppName} Options';
ShowModal;
end;
end;
I also tried poOwnerFormCenter
for the Position
property and by setting Left
and Top
properties, which seem to be ignored.
Is there a way to position this as described?
It indeed does not seem to work as expected.
Though this seems to work:
OptionsWindowForm := TForm.Create(WizardForm); { Make WizardForm the owner }
with OptionsWindowForm do
begin
Position := poOwnerFormCenter; { Center on the owner }
{ ... }
ShowModal;
end;