我创建了一个代码,可以在使用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;
提前致谢。
答案 0 :(得分:0)
在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 you call your function to start the playback
Log('NoBackgroundCheckBox is not checked, will play');
end;
end;
Result := True;
end;