ksadil
10th July 2009 06:58 UTC
At least one option
Hello,
Just learning NSIS, so please be patient with me.
I want to make an installer that has a mandatory "Base" component (have done this part successfully), and an optional client component, choice of option 1, option 2, and option 3 for example (done). But I want the user to have to choose at least one of the options. This is where I am struggling, I can present the options, but how do you ensure that at least one of the optional components are selected. It there an easy way?
Thanks,
Kim
Afrow UK
10th July 2009 12:19 UTC
Using Modern UI? In the leave function (put !define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentsPageLeave before !insertmacro MUI_PAGE_COMPONENTS) and then you can do something like this:
Function ComponentsPageLeave
${Unless} ${SectionIsSelected} ${SECTION1}
${AndUnless} ${SectionIsSelected} ${SECTION2}
${AndUnless} ${SectionIsSelected} ${SECTION3}
MessageBpx MB_OK|MB_ICONINFORMATION `Please select at least one optional client component.`
Abort
${EndUnless}
FunctionEnd
Note that you need to put this after your sections and SECTION# is defined by Section `Section Name` SECTION#.
Stu