在TInputDirWizardPage上浏览文件夹时生成的Inno Setup事件? [英] Inno Setup event that is generated when folder is browsed on TInputDirWizardPage?

查看:61
本文介绍了在TInputDirWizardPage上浏览文件夹时生成的Inno Setup事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自定义TInputDirWizardPage输入三个不同的目标文件夹进行安装.

I'm using a custom TInputDirWizardPage to input three different target folders for my installation.

更改第一个文件夹后,我想自动更改第三个文件夹的路径.是否可以创建在第一个文件夹中使用浏览"按钮并选择特定文件夹时发生的事件?如果是这样,是否还可以通过编程方式更改第3个文件夹的路径?

When the first folder is changed, I'd like to automatically change the 3rd folder's path. Is it possible to create an event that occurs when the Browse button is used for the first folder and a specific folder is selected? If so, is it also possible to change the 3rd folder's path programmatically?

推荐答案

您可以覆盖TInputDirWizardPage.Buttons[0].OnClick事件处理程序:

You can override TInputDirWizardPage.Buttons[0].OnClick event handler:

var
  DirPage: TInputDirWizardPage;
  PrevFirstButtonClick: TNotifyEvent;

procedure FirstButtonClick(Sender: TObject);
var
  PrevValue: string;
begin
  PrevValue := DirPage.Values[0];

  { Call remembered handler }
  PrevFirstButtonClick(Sender);

  if DirPage.Values[0] <> PrevValue then
  begin
    { And do whatever you want to do when the value changes }
    MsgBox(Format('Value changed from "%s" to "%s".', [PrevValue, DirPage.Values[0]]),
      mbInformation, MB_OK);
  end;
end;

procedure InitializeWizard();
begin
  DirPage := CreateInputDirPage(
    wpSelectDir, SetupMessage(msgWizardSelectDir), '', '', False, '');
  { add directory input page items }
  DirPage.Add('Path to Apache:');
  DirPage.Add('Path to PHP:');
  DirPage.Add('Path to Server Files:');

  { Remember the standard handler }
  PrevFirstButtonClick := DirPage.Buttons[0].OnClick;
  { And assign our override } 
  DirPage.Buttons[0].OnClick := @FirstButtonClick;
end;

代码需要Inno Setup的Unicode版本.在Ansi版本中奇怪地调用DirPage.Buttons[0].OnClick无效.

The code needs Unicode version of Inno Setup. Calling DirPage.Buttons[0].OnClick strangely does not work in Ansi version.

这篇关于在TInputDirWizardPage上浏览文件夹时生成的Inno Setup事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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