Inno Setup-从另一个对话框打开目录浏览对话框而不隐藏它 [英] Inno Setup - Opening directory browse dialog from another dialog without hiding it

查看:175
本文介绍了Inno Setup-从另一个对话框打开目录浏览对话框而不隐藏它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码:

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).

您可以做什么:

  • 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 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;

使用BrowseForFolderEx代替BrowseForFolder.

procedure SelectFileBrowseButtonClick(Sender: TObject);
var
  Dir: string;
begin
  Dir := GetSelectFilePath;
  BrowseForFolderEx(Dir);
  SelectFilePathEdit.Text := AddBackslash(Dir);
end;

这篇关于Inno Setup-从另一个对话框打开目录浏览对话框而不隐藏它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆