Inno Setup-从另一个对话框打开目录浏览对话框而不隐藏它 [英] Inno Setup - Opening directory browse dialog from another dialog without hiding it
问题描述
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?
推荐答案
BrowseForFolder
函数被实现为将WizardForm
作为所有者窗口.有效地将所有其他打开的对话框移到WizardForm
后面,同时显示浏览"对话框(请注意,这些对话框未隐藏,而被WizardForm
遮盖了).
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
).
您可以做什么:
- 从头开始重新实现
BrowseForFolder
.这是一项艰巨的任务. - 您可以使用
CreateInputDirPage
代替您的解决方案,什么我从一开始就建议您.
有关示例,请参见 Inno设置如何在浏览对话框上显示网络?
尽管我必须承认,但据我所知,您需要允许将不同的文件放在不同的文件夹中,但这也许不再是最好的解决方案.
- 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();
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;
使用BrowseForFolderEx
代替BrowseForFolder
.
procedure SelectFileBrowseButtonClick(Sender: TObject);
var
Dir: string;
begin
Dir := GetSelectFilePath;
BrowseForFolderEx(Dir);
SelectFilePathEdit.Text := AddBackslash(Dir);
end;
这篇关于Inno Setup-从另一个对话框打开目录浏览对话框而不隐藏它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!