Inno Setup在自定义向导页面上删除/隐藏/禁用NextButton

时间:2018-12-19 13:14:37

标签: inno-setup pascalscript

我想在我的自定义向导页面上禁用“下一步”按钮。 事实是,例如,更改标题时没有问题,但是如果我将NextButton.Enabled设置为False,Inno Setup将显示“欢迎”页面而不是“自定义页面”。任何想法?

procedure CurPageChanged(CurPageID: Integer);
begin
  WizardForm.NextButton.Caption := 'test'; { Works }
  WizardForm.NextButton.Enabled := false ; { delete my custom page }
  WizardForm.CancelButton.Caption := 'Finish';  
end;

procedure CreateTheWizardPages;
var
  Page: TWizardPage;
  TestConnectivityButton: TButton;
begin
  Page := CreateCustomPage(wpWelcome, 'Connectivity Test', '');
  CurPageChanged(Page.ID);
  TestConnectivityButton := TButton.Create(Page);
  TestConnectivityButton.Width := ScaleX(100);
  TestConnectivityButton.Height := ScaleY(30);
  TestConnectivityButton.Caption := CustomMessage('TestConnectivityAccessButtonLabel');
  TestConnectivityButton.OnClick := @TestConnectivityWindow;
  TestConnectivityButton.Parent := Page.Surface; 
 end;

procedure InitializeWizard;
begin
  CreateTheWizardPages;
end;

1 个答案:

答案 0 :(得分:0)

仅当进入自定义页面时,您必须进行更改-用CurPageChanged等于CurPageID调用Page.ID事件函数时。

您不能自己打CurPageChanged

var
  Page: TWizardPage;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = Page.ID then
  begin
    WizardForm.NextButton.Caption := 'Test';
    WizardForm.NextButton.Enabled := False ;
    WizardForm.CancelButton.Caption := 'Finish';  
  end;
end;

procedure CreateTheWizardPages;
var
  TestConnectivityButton: TButton;
begin
  Page := CreateCustomPage(wpWelcome, 'Connectivity Test', '');
  TestConnectivityButton := TButton.Create(Page);
  TestConnectivityButton.Width := ScaleX(100);
  TestConnectivityButton.Height := ScaleY(30);
  TestConnectivityButton.Caption := CustomMessage('TestConnectivityAccessButtonLabel');
  TestConnectivityButton.OnClick := @TestConnectivityWindow;
  TestConnectivityButton.Parent := Page.Surface; 
end;

enter image description here


另一种选择是使用Page.OnActivate事件而不是CurPageChanged事件函数。