CurPageChanged过程中的ShouldSkipPage函数

时间:2014-08-17 08:35:47

标签: inno-setup

我希望我的设置从CurPageChanged程序

移到下一页

详细信息 - 我将wpInstalling替换为ProgressPage,以使安装程序更加整洁, 完成ProgressPage后,我想转到下一页,因此我输入了ShouldSkipPage函数,

但是当我编译设置时,我一直得到"标识符除外" function ShouldSkipPage(curPageId : Integer)行上的错误消息。

procedure CurPageChanged(CurPageID: Integer);
    var
      I: Integer;
begin
  case CurPageID of
    MOPage.ID:
    begin
      // this code executes for the first page, so let's setup the buttons however you want
      WizardForm.BackButton.Visible := False;
      WizardForm.NextButton.Caption := '&Agree and Install';
      WizardForm.CancelButton.Caption := '&Abort';
    end;
    SOPage.ID:
    begin
      // this code executes for the second page, so let's setup the buttons however you want
      SkipSOSwitch := 1;
      WizardForm.BackButton.Visible := False;
      WizardForm.NextButton.Caption := '&Agree and Install';
      WizardForm.CancelButton.Caption := '&Decline';
      WizardForm.CancelButton.OnClick := @SkipSOEvent;
    end;
    FSPage.ID:
    begin
      WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish);
      WizardForm.NextButton.OnClick :=  @FinishButtonOnClick;
    end;
    IDPForm.Page.ID:
    begin
    // show the detail components
    idpShowDetails(True);
    // and hide the details button
    IDPForm.DetailsButton.Visible := False;
    end;
   wpInstalling: 
   begin
    ProgressPage.SetText('Starting installation...', 'Installing Wise Convert');
    ProgressPage.SetProgress(0, 0);
    WizardForm.ProgressGauge.Width := 600;
    ProgressPage.Show;
    try
    for I := 0 to 20 do begin
    ProgressPage.SetProgress(I, 20);
    Sleep(150);
    end;
    finally
    Sleep(3000);
    ProgressPage.Hide;
    function ShouldSkipPage(curPageId : Integer) : Boolean;
    begin
    Result := True
    end;
    end;
//  end else
//  WizardForm.NextButton.OnClick(WizardForm.NextButton);
    end;
    //StartTick := GetTickCount;
    end;        
  end; 

1 个答案:

答案 0 :(得分:2)

发生该错误是因为您尝试从另一个方法内部声明ShouldSkipPage事件方法。您的问题实际上可以简化为这段代码:

[Code]
procedure CurPageChanged(CurPageID: Integer);
begin
  function ShouldSkipPage(PageID: Integer): Boolean;
  begin
    Result := True;
  end;
end;

不允许这种结构。您不能在其他方法中声明事件方法。它们不能以任何方式嵌套(尽管您的声明实际上并未嵌套)。唯一允许声明它们的方法是:

[Code]
procedure CurPageChanged(CurPageID: Integer);
begin

end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := True;
end;

因此,您必须将ShouldSkipPage事件方法声明移出CurPageChanged事件方法。如果您希望您的事件以某种方式合作,则必须使用一些全局声明的变量。