如何跳转到按钮点击页面?

时间:2014-03-04 02:15:25

标签: windows installer inno-setup pascal

我需要一个简单的事情:拥有提前和正常的安装按钮。对于正常情况,它很简单 - 我在NextButtonClick上使用默认的下一个按钮和一些逻辑来设置条件变量并使用ShouldSkipPage来扭曲某些页面。然而,对于高级设置,我创建了一个新按钮,我在点击时需要它来打开下一个安装程序页面:

procedure CurPageChanged(CurPageID : Integer);
begin
if CurPageID = wpWelcome then begin
    AdvancedButton := TButton.Create(WizardForm);
    AdvancedButton.Caption := 'Advanced Install';
    AdvancedButton.Left := WizardForm.InfoAfterPage.Left + 10;
    AdvancedButton.Top := WizardForm.InfoAfterPage.Height + 88;
    AdvancedButton.Parent := WizardForm.NextButton.Parent;
    # AdvancedButton.OnClick :=  What shall I call to open say next page (or some page by given PageID value)
    end
    else begin
    AdvancedButton.Visible := False;
    end;

end;

那么我点击按钮点击打开下一页(或给定的PageID值的某个页面)是什么(在Inno API中找不到任何NextPage或某些SetPage函数)?

1 个答案:

答案 0 :(得分:1)

在Inno Setup中没有“直接跳到页面”这样的东西。 您只需在“高级模式”中安静地跳过某些页面。

只需在常规安装程序中执行相同操作即可。设置一个变量以保持“高级模式”。单击“高级”按钮后:

[Code]
var
  IsAdvanced: Boolean;

procedure AdvancedButtonClick(Sender: TObject);
begin
  IsAdvanced := True;
  WizardForm.NextButton.OnClick(nil);
end;

procedure InitializeWizard;
var
  AdvancedButton: TNewButton;
begin
  // not necessary; just for sure
  IsAdvanced := False;
  // create the button
  AdvancedButton := TNewButton.Create(WizardForm);
  AdvancedButton.Caption := 'Advanced Install';
  AdvancedButton.Left := WizardForm.InfoAfterPage.Left + 10;
  AdvancedButton.Top := WizardForm.InfoAfterPage.Height + 88;
  AdvancedButton.Parent := WizardForm.NextButton.Parent;
  AdvancedButton.OnClick := @AdvancedButtonClick;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  // the <page where you want to end up> fill with the wizard page constant
  // of the page where you want to end up, e.g. wpReady
  Result := IsAdvanced and (PageID <> <page where you want to end up>);
end;

通过这种逻辑,您可以模拟到某个页面的安静“跳跃”。

相关问题