2015-08-19 71 views
0

我接下來的兩節當複選框被選中我想另外一個是赤

Section /o "Communications Toolbox" 
    ;SectionIn RO 
FileWrite $9 "product=Communications Toolbox$\r$\n" 
    AddSize 0 
SectionEnd 


Section /o "Control System Toolbox" 
    ;SectionIn RO 
FileWrite $9 "product=Control System Toolbox$\r$\n" 
    AddSize 0 
SectionEnd 

,並在安裝的過程中,當用戶選中第二個「控制系統工具箱」,自動第一個「通訊工具箱」我想檢查,並在那一刻顯示一條消息「要安裝控制系統工具箱,你還需要安裝」通訊工具箱「。 我該怎麼做這件事?

我試圖把一個文本框放在「控制系統工具箱」中:

Section /o "Control System Toolbox" 
    MessageBox MB_OK "Do you want to stay in the license page?" IDOK 
    Abort 
FileWrite $9 "product=Control System Toolbox$\r$\n" 
    AddSize 0 
SectionEnd 

我不明白爲什麼我按下按鈕後OK,沒有翻到前一頁?

+0

說說你返回到前一頁但在你的例子中沒有頁面代碼,我們應該怎麼知道你真的想要做什麼? – Anders

回答

1

有兩種方式來處理這個問題:

A)強制組件頁面上的要求:

Page Components 
Page InstFiles 

Section /o "Main Component" SID_MAIN 
DetailPrint "Installing Main Component..." 
SectionEnd 

Section /o "Bonus feature" SID_BONUS 
DetailPrint "Installing bonus Component..." 
SectionEnd 

!include Sections.nsh 
!include LogicLib.nsh 
Function .OnSelChange 
${If} ${SectionIsSelected} ${SID_BONUS} 
    !insertmacro SelectSection ${SID_MAIN} ; The main component is required when installing the bonus component 
    !insertmacro SetSectionFlag ${SID_MAIN} ${SF_RO} 
${Else} 
    !insertmacro ClearSectionFlag ${SID_MAIN} ${SF_RO} 
${EndIf} 
FunctionEnd 

您也可以使用部分羣體喜歡I suggested在您的其他問題。

如果需要安裝B)使用過程中安裝階段的MessageBox(在部分代碼的InstFiles頁面上執行),並強制組件:

Page Components 
Page InstFiles 

Section "" ; Hidden section 
Call EnsureRequiredSections ; We have to call a function because SID_MAIN has not been defined yet 
SectionEnd 

Section "Main Component" SID_MAIN 
DetailPrint "Installing Main Component..." 
SectionEnd 

Section /o "Bonus feature" SID_BONUS 
DetailPrint "Installing bonus Component..." 
SectionEnd 

!include Sections.nsh 
!include LogicLib.nsh 
Function EnsureRequiredSections 
${If} ${SectionIsSelected} ${SID_BONUS} 
${AndIfNot} ${SectionIsSelected} ${SID_MAIN} 
    MessageBox MB_YESNO|MB_ICONQUESTION "Main Component is required when installing the Bonus feature, do you want to install both?" IDNO no 
    !insertmacro SelectSection ${SID_MAIN} 
    Goto done 
    no: 
    !insertmacro UnSelectSection ${SID_BONUS} 
    done: 
${EndIf} 
FunctionEnd 
相關問題