【问题标题】:How do I create a checkbox on Ready page如何在就绪页面上创建复选框
【发布时间】:2016-06-07 13:31:39
【问题描述】:

在使用 Inno Setup 安装我的程序时,我创建了一个播放幻灯片或播放背景视频的代码。 但我想在背景选项选择向导页面 (CurPageID=wpReady) 中添加一个复选框,可以禁用背景视频/幻灯片播放。

当我喜欢添加的复选框被选中时,我希望它停止播放背景幻灯片或视频,只显示安装进度页面 (CurPageID=wpInstalling)。

我写了这个,但编译器一直在说

第 1053 行,第 3 列,应为标识符

我写的脚本:

var
NoBackgroundCheckBox: TNewCheckBox;

procedure NoBackgroundCheckBoxClick(Sender: TObject);
begin
  if NoBackgroundCheckBox.Checked then
  begin
    with WizardForm do
  begin
    FWAdd:=False
  end else begin
    with WizardForm do
  begin
    FWAdd:=True
    end;
  end;

with NoBackgroundCheckBox do
  begin
    Name := 'NoBackgroundCheckBox';
    Parent := WizardForm;
    Left := ScaleX(560);
    Top := ScaleY(115);
    Width := ScaleX(90);
    Height := ScaleY(14);
    Alignment := taLeftJustify;
    Caption := 'No Background Option';
    OnClick := @NoBackgroundCheckBoxClick;
  end;
  NoBackgroundCheckBox.TabOrder := 3;
end;

提前致谢。

【问题讨论】:

    标签: checkbox inno-setup pascalscript


    【解决方案1】:

    InitializeWizard 中创建复选框。并在NextButtonClick(wpReady) 中测试其状态,以决定是否开始播放。或者你也可以使用CurStepChanged(ssInstall)

    var
      NoBackgroundCheckBox: TNewCheckBox;
    
    procedure InitializeWizard();
    begin
      { shrink the "Ready" memo to make room for the checkbox }
      WizardForm.ReadyMemo.Height := WizardForm.ReadyMemo.Height - ScaleY(24);
    
      { create the checkbox }
      NoBackgroundCheckBox := TNewCheckBox.Create(WizardForm);
      with NoBackgroundCheckBox do
      begin
        Parent := WizardForm.ReadyMemo.Parent;
        Left := WizardForm.ReadyMemo.Left;
        Top := WizardForm.ReadyMemo.Top + WizardForm.ReadyMemo.Height + ScaleY(8);
        Height := ScaleY(Height);
        Width := WizardForm.ReadyMemo.Width;
        Caption := 'No Background Option';
      end;
    end;
    
    function NextButtonClick(CurPageID: Integer): Boolean;
    begin
      { Next button was just clicked on the "Ready" page }
      if CurPageID = wpReady then
      begin
        { is the checkbox checked? }
        if NoBackgroundCheckBox.Checked then
        begin
          Log('NoBackgroundCheckBox is checked, won''t play anything');
        end
          else
        begin
          { the checkbox is not checked, here call your function to start the playback }
          Log('NoBackgroundCheckBox is not checked, will play');
        end;
      end;
    
      Result := True;
    end;
    

    【讨论】:

      猜你喜欢
      • 2023-03-08
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-09
      • 2013-01-06
      相关资源
      最近更新 更多