ShouldSkipPage function inside CurPageChanged procedure

I want my installation to navigate to the next page from the procedure CurPageChanged

,

Details - I replace wpInstalling

with ProgressPage

to make the installtion run more tidy.Once finished, ProgressPage

I want to go to the next page, so I introduced a function ShouldSkipPage

,

but when I compile the installation, I keep getting an "ID excluded" error on the line 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 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 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; 

      

+3


source to share


1 answer


This error occurs because you are trying to declare your method ShouldSkipPage

from another method. Your problem can actually be simplified to this piece of code:

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

      

This design is not allowed. You cannot declare event methods inside others. They cannot be nested in any way (although your declaration is not actually nested). The only permitted way to declare them is:



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

end;

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

      

So, you need to move ShouldSkipPage

the event method declaration from CurPageChanged

. If you want your events to cooperate in some way, you will have to use some declared globals.

+2


source







All Articles