2014-01-27 39 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;