我想用我的設置中的組件頁面交換SelectDir頁面。如何更改InnoSetup頁面的順序?
我找到了一個解決方案,將其他頁面的內容分配給當前頁面。
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectDir:
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents)
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption;
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc)
end;
wpSelectComponents:
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WzardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir)
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint
end;
end;
End;
使用此方法的問題是隻有內容而不是實際頁面發生更改。消息框和錯誤消息不受影響。我寫了許多代碼行來解決這些問題,但我遇到了越來越多的問題...
有沒有更好的解決方案?我希望你可以幫助我!
編輯:嘗試了一下後,我想出了這個:
procedure RedesignWizard;
var
Page: TWizardPage;
begin
Page := CreateCustomPage(wpWelcome, 'bla', 'bla');
WizardForm.ComponentsList.Parent := Page.Surface;
//Here I am changing the layout of the pages...
end;
procedure InitializeWizard;
begin
RedesignWizard;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if (CurPageID = Page.ID) then
begin
//perform your actions specific to the Custom page here.
end;
end;
這樣的組件列表中SelctDirPage出庭時,我沒有任何更多的問題與這些消息框。
總之,不要那樣做。有檢查綁定到* Next *按鈕點擊,並且這些檢查由您不能覆蓋的頁面ID常量驅動。想象一下,當你點擊* Next *按鈕的用戶以及(在某些情況下)目錄編輯框中的默認目錄已經存在時,會發生什麼情況。是的,*「文件夾:c:\東西已存在,您是否想要安裝到該文件夾?」消息對話框從組件頁面彈出,什麼是廢話。 – TLama
我知道這一點,因此寫了一些檢查以在頁面上使用TLabel顯示消息,並在上面的解決方案中禁用「下一步」按鈕。我真的需要交換這些頁面,如果有更簡單的解決方案,我想知道。我可以自己處理剩下的東西。 – user1662035
如果我們誤解了彼此......您提到的問題發生在使用上面顯示的方法時。我禁用了所有的消息框,並嘗試解決錯誤頁面上的消息框的問題,但我遇到了越來越多的問題。這就是爲什麼我想使用另一種方法,因爲我真的需要交換這些頁面。是否可以創建自定義頁面並將SelectComponentsPage的值分配給它?甚至還有其他一些方式?否則,我將不得不擺脫每個問題。 – user1662035