2011-11-09 93 views

回答

7

Inno有一個靈活的對話框/頁面引擎,它允許您在嚮導流程中創建自定義頁面。請參閱隨Inno安裝附帶的CodeDlg.iss example以瞭解如何執行此操作的一個很好的示例。

+0

非常感謝。 – andDaviD

3
[Code] 
var 
lblDomain: TLabel; 
lblUserName: TLabel; 
lblPassword: TLabel; 
txtDomain: TEdit; 
txtUserName: TEdit; 
txtUserPassword: TPasswordEdit; 

procedure frmDomainReg_Activate(Page: TWizardPage); 
begin 
end; 

function frmDomainReg_ShouldSkipPage(Page: TWizardPage): Boolean; 
begin 
Result := False; 
end; 

function frmDomainReg_BackButtonClick(Page: TWizardPage): Boolean; 
begin 
Result := True; 
end; 

function frmDomainReg_NextButtonClick(Page: TWizardPage): Boolean; 
begin 
Result := True; 
end; 

procedure frmDomainReg_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean); 
begin 
end; 

function frmDomainReg_CreatePage(PreviousPageId: Integer): Integer; 
var 
Page: TWizardPage; 
begin 
Page := CreateCustomPage(
PreviousPageId, 
'Domain Registration', 
'Enter Domain Registration Data' 
); 

{ lblDomain } 
lblDomain := TLabel.Create(Page); 
with lblDomain do 
begin 
Parent := Page.Surface; 
Left := ScaleX(24); 
Top := ScaleY(24); 
Width := ScaleX(35); 
Height := ScaleY(13); 
Caption := 'Domain'; 
end; 

{ lblUserName } 
lblUserName := TLabel.Create(Page); 
with lblUserName do 
begin 
Parent := Page.Surface; 
Left := ScaleX(24); 
Top := ScaleY(56); 
Width := ScaleX(52); 
Height := ScaleY(13); 
Caption := 'User Name'; 
end; 

{ lblPassword } 
lblPassword := TLabel.Create(Page); 
with lblPassword do 
begin 
Parent := Page.Surface; 
Left := ScaleX(24); 
Top := ScaleY(88); 
Width := ScaleX(46); 
Height := ScaleY(13); 
Caption := 'Password'; 
end; 

{ txtDomain } 
txtDomain := TEdit.Create(Page); 
with txtDomain do 
begin 
Parent := Page.Surface; 
Left := ScaleX(120); 
Top := ScaleY(16); 
Width := ScaleX(185); 
Height := ScaleY(21); 
TabOrder := 0; 
end; 

{ txtUserName } 
txtUserName := TEdit.Create(Page); 
with txtUserName do 
begin 
Parent := Page.Surface; 
Left := ScaleX(120); 
Top := ScaleY(48); 
Width := ScaleX(185); 
Height := ScaleY(21); 
TabOrder := 1; 
end; 

{ txtUserPassword } 
txtUserPassword := TPasswordEdit.Create(Page); 
with txtUserPassword do 
begin 
Parent := Page.Surface; 
Left := ScaleX(120); 
Top := ScaleY(80); 
Width := ScaleX(185); 
Height := ScaleY(21); 
TabOrder := 2; 
end; 


with Page do 
begin 
OnActivate := @frmDomainReg_Activate; 
OnShouldSkipPage := @frmDomainReg_ShouldSkipPage; 
OnBackButtonClick := @frmDomainReg_BackButtonClick; 
OnNextButtonClick := @frmDomainReg_NextButtonClick; 
OnCancelButtonClick := @frmDomainReg_CancelButtonClick; 
end; 

Result := Page.ID; 
end; 

procedure InitializeWizard(); 
begin 
{this page will come after welcome page} 
frmDomainReg_CreatePage(wpWelcome); 
end; 
+2

請稍微描述一下代碼,而不是完全拋棄它。 – NREZ

相關問題