2017-10-14 114 views
0

我原本想問如何做幾個功能,我如何在設置文件中工作。所以我現在有兩個問題。拍着我的背,因爲我想通了一切:)NSIS選擇頁面

好了,所以這裏是我想什麼:

是否有可能有較高的名單所以沒有滾動?也可以 我們可以讓標題只有那個而沒有複選框嗎? (他們是無線電按鈕,標題是他們的分組)

我怎麼能在自定義頁面中創建相同的東西,所以我可以控制這些元素? (包括鼠標移過元件頁面的功能)

感謝您的期待,並希望您能幫我編寫代碼。

代碼:(是的,我知道!包括在測試中並不都需要購買我的應用程序,所以我只是離開了它)驗證和其他一些設置還沒有完成,我只是得到一些例子的工作。)

!include WinVer.nsh 
!include LogicLib.nsh 
!include x64.nsh 
!include FileFunc.nsh 
!include MUI.nsh 
!include WinMessages.nsh 
!include InstallOptions.nsh 
!include Sections.nsh 

!define MUI_COMPONENTSPAGE_TEXT_TOP "Please select the options that best match your setup and preferances." 
!define MUI_COMPONENTSPAGE_TEXT_COMPLIST " " 
!define MUI_PAGE_HEADER_TEXT "Setup Options" 
!define MUI_PAGE_HEADER_SUBTEXT " " 
!define MUI_COMPONENTSPAGE_smallDESC 
!insertmacro MUI_PAGE_COMPONENTS 

!insertmacro MUI_PAGE_INSTFILES 
!insertmacro MUI_PAGE_FINISH 



!insertmacro MUI_LANGUAGE "English" 


SectionGroup /e "!Sets" SetsTitle #Section Should be Radio Buttons 

    Section "Set 1" Set1 
    SectionEnd 

    Section /o "Set 2" Set2 
    SectionEnd 

    Section /o "Skip" SetSkip 
    SectionEnd 

SectionGroupEnd 


SubSection /e "!Setup" SetupTitle #Section Should be Radio Buttons 

    Section "Setup 1" setup1 
    SectionEnd 

    Section /o "Setup 2" setup2 
    SectionEnd 

    Section /o "None" setupNone 
    SectionEnd 

SubSectionEnd 


SubSection /e "!AutoLoad" ALTitle #Section Should be Radio Buttons 

    Section "Yes" ALYes 
    SectionEnd 

    Section /o "No" ALNo 
    SectionEnd 

SubSectionEnd 

SubSection /e "!Disable Feature" DFTitle #Section Should be Check Boxes 

    Section "Feature 1" DAF1 
    SectionEnd 

    Section "Feature 2" DAF2 
    SectionEnd 

SubSectionEnd 

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 
!insertmacro MUI_DESCRIPTION_TEXT ${SetsTitle} "Sets Description" 
!insertmacro MUI_DESCRIPTION_TEXT ${Set1} "Set1 Description" 
!insertmacro MUI_DESCRIPTION_TEXT ${Set2} "Set2 Description" 
!insertmacro MUI_DESCRIPTION_TEXT ${SetSkip} "SetNone Description" 
!insertmacro MUI_FUNCTION_DESCRIPTION_END 


Section -InstallSelectedOptions 

${If} ${SectionIsSelected} ${set1} 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "set1" 
${endif} 

${If} ${SectionIsSelected} ${set2} 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "set2" 
${endif} 


${If} ${SectionIsSelected} ${setskip} 
    MessageBox MB_OK|MB_USERICON|MB_TOPMOST "setnone" 
${endif} 


${If} ${Setup1} == true 

${endif} 


SectionEnd 

Function .onInit 

    StrCpy $1 ${set1} ; Group 1 - Option 1 is selected by default 
    StrCpy $2 ${setup1} ; Group 2 - Option 1 is selected by default 

FunctionEnd 

Function .onSelChange 
    !insertmacro StartRadioButtons $1 
    !insertmacro RadioButton ${set1} 
    !insertmacro RadioButton ${set2} 
    !insertmacro RadioButton ${setskip} 
    !insertmacro EndRadioButtons 

    !insertmacro StartRadioButtons $2 
    !insertmacro RadioButton ${setup1} 
    !insertmacro RadioButton ${setup2} 
    !insertmacro RadioButton ${setupNone} 
    !insertmacro EndRadioButtons 

FunctionEnd 

回答

2

不能同時使用單選按鈕和複選標記的內置組件頁面上,但你可以使用自己定製的單選按鈕.BMP文件與!define MUI_COMPONENTSPAGE_CHECKBITMAP "myradio.bmp"

您可以通過定義MUI_COMPONENTSPAGE_SMALLDESCMUI_COMPONENTSPAGE_NODESC一點點定製MUI組件頁面,但如果你需要不止,你必須複製和修改「... \ NSIS \的Contrib \用戶界面\ modern.exe」與Resource Hacker和將此自定義用戶界面應用於MUI_UI

作爲自定義頁面複製組件頁面可能是可能的,但它是很多工作。 nsDialogs對TreeView控件沒有太多的支持,所以如果沿着這條路線走,你幾乎可以自己做。