NSIS 选择页面

NSIS Selections Page

我本来想问的是如何实现设置文件中的几个功能。所以我现在有两个问题。拍拍自己的背,因为我弄清楚了其他一切:)

好的,这就是我想要的:

是否可以让列表更高而不滚动?还 我们可以只使用标题而没有复选框吗? (他们是radio-buttons,标题是他们的分组)

我怎样才能在自定义页面中创建相同的内容以便我可以控制元素? (包括组件页面的鼠标移动功能)

感谢您的浏览,希望您能帮我编码。

代码:(是的,我知道 !included 在测试购买我的应用程序时并不是全部都需要,所以我就把它留下了)此外,验证和其他一些设置还没有完成,我只是得到一些例子去工作。)

!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  ${set1} ; Group 1 - Option 1 is selected by default
  StrCpy  ${setup1} ; Group 2 - Option 1 is selected by default

FunctionEnd

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

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

FunctionEnd

您不能在内置组件页面上组合单选按钮和复选标记,但您可以使用自己的自定义单选按钮 .BMP 文件 !define MUI_COMPONENTSPAGE_CHECKBITMAP "myradio.bmp"

您可以通过定义 MUI_COMPONENTSPAGE_SMALLDESCMUI_COMPONENTSPAGE_NODESC 稍微自定义 MUI 组件页面,但如果您需要更多,则必须复制和修改“... \NSIS\Contrib\UIs\modern.exe" 与 Resource Hacker 并应用此自定义 UI 与 MUI_UI.

将组件页面复制为自定义页面可能是可行的,但需要大量工作。 nsDialogs 对 TreeView 控件的支持不多,所以如果你走这条路,你几乎只能靠自己了。