Search code examples
controlsinno-setuppascalscript

Change position of restart option radio buttons in Finished page of Inno Setup


How to change the location of these controls?

The restart radio buttons do not seem to be changing its location even when you change it using .Top.

Here is the code:

[Code]
procedure InitializeWizard;
begin
  with WizardForm do
  begin
    { NOT WORKING }
    YesRadio.Top := ScaleY(450);
    NoRadio.Top := ScaleY(750);

    { WORKING }
    YesRadio.Left := ScaleX(200);
    NoRadio.Left := ScaleX(200);

    NoRadio.Checked := True;
  end;
end;

Also, if you add this code:

[Setup]
WizardStyle=modern

Both .Left and .Top do not work.


Solution

  • The vertical position of the YesRadio and NoRadio are calculated just before the "Finished" page shows, based on the other contents of the page (particularly the height of FinishedLabel and RunList).

    If you want to override the location, you need to do it in CurPageChanged event function:

    procedure CurPageChanged(CurPageID: Integer);
    begin
      if CurPageID = wpFinished then
      begin
        WizardForm.YesRadio.Top := ScaleY(450);
        WizardForm.NoRadio.Top := ScaleY(750);
      end;
    end;
    

    But make sure you know, what you are doing, not to cause the radio buttons overlap with other dynamic contents.