Nils Guillermin
Nils Guillermin

Reputation: 1987

Inno Setup BrowseForFolder dialog with Address bar

When I use the BrowseForFolder function in Inno Setup I get a dialog like this

enter image description here

Is it possible to get a dialog with an address bar such as this one?

enter image description here

Upvotes: 3

Views: 1335

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202222

Use the TInputDirWizardPage (CreateInputDirPage), instead of using the BrowseForFolder function.

The page has the browse dialog as you want (actually I assume your second screenshot shows this dialog).


If you do not want to add a new page, just create a fake one and abuse it.

var
  FakePage: TInputDirWizardPage;

procedure BrowseForFolderEx(var Directory: String);
begin
  FakePage.Values[0] := Directory;
  FakePage.Buttons[0].OnClick(FakePage.Buttons[0]);
  Directory := FakePage.Values[0];
end;

procedure InitializeWizard();
begin
  FakePage :=
    CreateInputDirPage(wpWelcome, '', '', '', False, SetupMessage(msgButtonNewFolder));
  FakePage.Add('');
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := (PageID = FakePage.ID);
end;

Upvotes: 2

Related Questions