2
votes

I ve got problems to set a button on the same topsize as the Cancel button when im using WizardSizePercent = 150 in the Setup section.

Here is my code:

AboutButton := TNewButton.Create(WizardForm);
AboutButton.Parent := WizardForm;
AboutButton.Left := WizardForm.CancelButton.Left;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;

I think Inno Setup doesn't notice the WizardSizePercent, because it only uses the regular WizardForm size.

1

1 Answers

2
votes

I assume your code is in InitializeWizard. That event function occurs before WizardSizePercent is applied. If you want your button to correctly align when the wizard window changes size, either due to WizardSizePercent or WizardResizable, you need follow their documentation:

Use Anchors and KeepSizeY properties to add full support for WizardResizable and WizardSizePercent to all your custom controls, custom wizard pages and TSetupForm forms if you have any. See the CodeClasses.iss example script for an example.

So particularly:

AboutButton.Anchors := WizardForm.CancelButton.Anchors;

CancelButton.Anchors is [akRight, akBottom]. If your "About" button should be left-aligned, use:

AboutButton.Anchors := [akLeft, akBottom];

Related question:
Adding a Print button to the License page in Inno Setup (revisited for Inno Setup 6)