我有一个带有几个选项的自定义选项页面。在CurPageChanged
事件中,我想知道选择了哪个选项,如果选择了特定选项,则提示用户是否确定要使用该选项。此页面是欢迎页面后面的第一页......
procedure CreateInstallTypePage;
begin
InstallTypePage:= CreateInputOptionPage(1, 'Installation Type', 'Specify whether this is a client installation or server installation, or both.', 'Choose an installation type:', True, False);
InstallTypePage.Add('This is a client computer');
InstallTypePage.Add('This is the main server computer');
InstallTypePage.Add('This is the only computer (stand-alone)');
InstallTypePage.Values[0]:= True;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
Log('CurPageChanged(' + IntToStr(CurPageID) + ') called');
case CurPageID of
1: begin
if InstallTypePage.Values[1] then begin
if MsgBox('Server installation will create a new database on this machine. Continue?',
mbInformation, MB_YESNO) = idYes then
begin
//Continue to next page
end else begin
//Don't continue to next page
end;
end;
end;
end;
end;
这不起作用,当用户从该页面按下Next时不会提示。相反,它在用户返回页面时起作用。显然这不是我需要的。如何让这个提示工作?
答案 0 :(得分:0)
更多地摆弄它让它弄清楚了。我不得不转移到NextButtonClick
而不是CurPageChanged
,因为CurPageChanged
发生在事后......
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
Log('NextButtonClick(' + IntToStr(CurPageID) + ') called');
Result := True;
case CurPageID of
InstallTypePage.ID: begin
if InstallTypePage.Values[INSTALL_SERVER] then begin
Result:= MsgBox('Server installation will create a new database on this machine. Continue?', mbInformation, MB_YESNO) = idYes;
end;
end;
end;
end;