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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
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 theBrowseForFolder
: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;
Use
BrowseForFolderEx
instead ofBrowseForFolder
.procedure SelectFileBrowseButtonClick(Sender: TObject); var Dir: string; begin Dir := GetSelectFilePath; BrowseForFolderEx(Dir); SelectFilePathEdit.Text := AddBackslash(Dir); end;
标签:
inno-setup