2014-01-27 38 views
0

我有一个自定义选项页面,有几个选项。在CurPageChanged事件中,我想知道选择了哪个选项,如果选择了某个选项,请提示用户是否确定要使用该选项。这页是欢迎页面后右一...页面上的Inno Setup提示已更改?

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; 

这不是工作,当用户按下从上页下它不会提示。相反,它在用户返回页面时起作用。显然这不是我所需要的。我如何得到这个提示工作?

+0

其实我只是意识到CurPageChanged是放错了地方,NextButtonClick应该是这个地方... –

回答

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;