Reputation: 1027
I am using this code: Inno Setup - How to create a custom form that allows me to locate the files to decompress? How to open directory browse dialog from another dialog without hiding it?
Upvotes: 4
Views: 1994
Reputation: 202222
The dialog opened by BrowseForFolder
function is unfortunately implemented to have the WizardForm
as an owner window. That effectively moves all other opened dialogs behind the WizardForm
, while the "browse" dialog is showing (note that the dialogs are not hidden, they are just obscured by the WizardForm
).
What you can do:
Re-implement BrowseForFolder
from scratch. That's a huge task.
You can use CreateInputDirPage
instead of your solution, what I have suggested you at the very beginning at your previous question.
For an example, see Inno Setup How to show network on a browse dialog?
Though I must admit, that now that I understand, that you need to allow different files in different folders, this is maybe not the best solution anymore.
As a workaround, you can abuse a different browse dialog implementation by the TInputDirWizardPage
, that does not suffer the problem of the BrowseForFolder
:
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();
var
NewFolderName: string;
begin
NewFolderName := SetupMessage(msgButtonNewFolder);
FakePage := CreateInputDirPage(wpWelcome, '', '', '', False, NewFolderName);
FakePage.Add('');
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := (PageID = FakePage.ID);
end;
Use BrowseForFolderEx
instead of BrowseForFolder
.
procedure SelectFileBrowseButtonClick(Sender: TObject);
var
Dir: string;
begin
Dir := GetSelectFilePath;
BrowseForFolderEx(Dir);
SelectFilePathEdit.Text := AddBackslash(Dir);
end;
Upvotes: 3