Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A ShouldSkipPage function inside CurPageChanged procedure

Tags:

inno-setup

I want my setup to move to the next page from within a CurPageChanged procedure,

Details- I replace the wpInstalling with ProgressPage to make the installtion prograss more neat, After ProgressPage finish I want to move to next page, so I entered ShouldSkipPage function,

but when I compile the setup I keep getting the "Identifier excepted " error message on the function ShouldSkipPage(curPageId : Integer) line.

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; 
like image 631
ElramV Avatar asked May 18 '26 07:05

ElramV


1 Answers

That error occurs because you are trying to declare your ShouldSkipPage event method from inside another method. Your problem could be actually simplified to this piece of code:

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

Such construction is not allowed. You cannot declare event methods inside another ones. They cannot be nested, in any way (though your declaration is not actually nested). The only allowed way to declare them is this:

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

end;

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

So you have to move your ShouldSkipPage event method declaration out of your CurPageChanged event method. If you want your events cooperate somehow, you will have to use some globally declared variable(s).

like image 102
TLama Avatar answered May 21 '26 02:05

TLama