首页 > 解决方案 > 返回时正在创建重复页面

问题描述

我创建了单击下一步时创建的自定义页面。但是单击下一步后,我要返回,再次单击下一步,会创建重复页面。

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if CurPageID = wpSelectTasks  then
   begin
        myPage := CreateCustomPage(wpSelectTasks, 'ABC', '');
         CustomPageID := myPage.ID;
        StaticText5 := TNewStaticText.Create(myPage);
        StaticText5.Caption := 'BCD ';
        StaticText5.AutoSize := True;
        StaticText5.Parent := myPage.Surface;
        StaticText5.height:=14;
        StaticText5.Font.size :=  8;
  end
else
begin
Result := True;
end;

标签: inno-setuppascalscript

解决方案


您应该在名为"InitializeWizard"的特殊预定义事件过程中创建所有附加页面。确保全局声明此处使用的所有(对象)变量(例如 myPage、CustomPageID、StaticText5 等)

procedure InitializeWizard;
begin
  // Create custom pages here...
  myPage := CreateCustomPage(wpSelectTasks, 'ABC', '');
  CustomPageID := myPage.ID;
  // ... followed by the page design specific creates and assignments:
  StaticText5 := TNewStaticText.Create(myPage);
  // ...
  // ...
end;

推荐阅读