NSIS选择页面

时间:2017-10-14 09:16:34

标签: nsis

我原本打算询问如何使用我在set文件中工作的几个功能。所以我现在有2个问题。自从我弄清楚其他所有事情后,我自己背拍自己:)

好的,这就是我想要的:

是否可以让列表更高,所以不滚动?也 我们可以拥有标题而不是复选框吗? (它们是单选按钮,标题是它们的分组)

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

感谢您的关注并希望您能帮我编写代码。

代码:(并且是的,我知道!包含的并不是所有需要在测试中购买我的应用程序,所以我只是离开它)此外验证和一些其他设置没有完成,我只是得到一些例子工作。)

!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

1 个答案:

答案 0 :(得分:2)

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

您可以通过定义MUI_COMPONENTSPAGE_SMALLDESCMUI_COMPONENTSPAGE_NODESC来自定义MUI组件页面,但如果您需要更多,则必须复制和修改" ... \ NSIS \ Contrib \的UI \ modern.exe"使用Resource Hacker并将此自定义用户界面与MUI_UI一起应用。

将组件页面复制为自定义页面可能是可能的,但这需要做很多工作。 nsDialogs对TreeView控件的支持不多,所以如果沿着这条路走下去,你几乎可以自己动手。