Search code examples
installationinno-setuppascalscript

How to reduce the line spacing between two input boxes on Inno Setup TInputQueryWizardPage (CreateInputQueryPage)


I have a TInputQueryWizardPage page with 8 user inputs. The wizard page has been increased but still all the values are not visible. Is there a way to reduce the line spacing between two values so that all the values will be displayed with the current wizard size?

enter image description here


Solution

  • Use TInputQueryWizardPage.Edits and TInputQueryWizardPage.PromptLabels to access the controls and re-locate them as you need:

    [Code]
    
    procedure ReducePromptSpacing(Page: TInputQueryWizardPage; Count: Integer; Delta: Integer);
    var
      I: Integer;
    begin
      for I := 1 to Count - 1 do
      begin
        Page.Edits[I].Top := Page.Edits[I].Top - Delta * I;
        Page.PromptLabels[I].Top := Page.PromptLabels[I].Top - Delta * I;
      end;
    end;
    
    procedure InitializeWizard();
    var
      Page: TInputQueryWizardPage;
    begin
      Page := CreateInputQueryPage(wpWelcome,
        'Personal Information', 'Who are you?',
        'Please specify your name and the company for whom you work, then click Next.');
    
      Page.Add('Prompt 1:', False);
      Page.Add('Prompt 2:', False);
      Page.Add('Prompt 3:', False);
      Page.Add('Prompt 4:', False);
      Page.Add('Prompt 5:', False);
    
      ReducePromptSpacing(Page, 5, ScaleY(10));
    end;
    

    Standard layout:

    enter image description here

    Layout with the spacing reduced by 10 pixels:

    enter image description here