【问题标题】:Duplicate Pages are creating on going back返回时正在创建重复页面
【发布时间】:2019-07-31 03:01:27
【问题描述】:

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

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;

【问题讨论】:

  • 嗨。如果有人可以尝试帮助您解决问题,您需要出示您的脚本。
  • function NextButtonClick(CurPageID: Integer): Boolean;如果 CurPageID = wpSelectTasks 然后开始 myPage := CreateCustomPage(wpSelectTasks, 'ABC', ''); CustomPageID := myPage.ID; StaticText5 := TNewStaticText.Create(myPage); StaticText5.Caption := 'BCD'; StaticText5.AutoSize := 真; StaticText5.Parent := myPage.Surface; StaticText5.height:=14; StaticText5.Font.size := 8;结束否则开始结果:=真;结束;
  • 太棒了。我建议您将代码放在问题本身中。 ??????
  • 为什么要创建页面“点击下一步”?我没有看到您的代码需要这样做的任何动态/变化。
  • 所以请发布您的解决方案作为答案。

标签: inno-setup pascalscript


【解决方案1】:

您应该在名为 “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;

【讨论】:

  • 一般正确。但并非所有变量都需要在全局范围内声明。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-25
  • 2021-11-22
  • 2021-09-23
  • 2020-07-07
  • 2021-08-22
相关资源
最近更新 更多