Hi,
Is it possible to force the selection of a section if its parent SectionGroup is checked?
Force a section if sectiongroup is selected
6 posts
1. Do you want make section name show in bold (is this "force the selection of a section")?
2. Do you want force selection at runtime?
3. Do you want force selection of all checked sections?
2. Do you want force selection at runtime?
3. Do you want force selection of all checked sections?
In fact, I have 2 sectionsgroups.
The first sectiongroup named "program1" contains 3 sections:
- program binaries
- shortcut on desktop
- shortcut in start menu
I want to prevent a user to check "shortcut on desktop" or "shortcut in start menu" without checking "program binaries"
I can't use SectionIn RO because I want the users to be able to uncheck the whole SectionGroup.
The first sectiongroup named "program1" contains 3 sections:
- program binaries
- shortcut on desktop
- shortcut in start menu
I want to prevent a user to check "shortcut on desktop" or "shortcut in start menu" without checking "program binaries"
I can't use SectionIn RO because I want the users to be able to uncheck the whole SectionGroup.
Try this:
Add: Is this what you want?
!define LOGICLIB_SECTIONCMP
!include Sections.nsh
!include logiclib.nsh
var prevcond
...
SectionGroup "Group" SG
Section "SG1" sg1
SectionEnd
Section "SG2" sg2
SectionEnd
Section "SG3" sg3
SectionEnd
SectionGroupEnd
...
Function .onSelChange
${If} $prevcond != "checked"
${Unless} ${SectionIsSelected} ${sg1}
${If} ${SectionIsSelected} ${sg2}
${OrIf} ${SectionIsSelected} ${sg3}
!insertmacro SelectSection ${sg1}
${EndIf}
StrCpy $prevcond "checked"
${EndIf}
${Else}
${Unless} ${SectionIsSelected} ${sg1}
!insertmacro UnSelectSection ${sg2}
!insertmacro UnSelectSection ${sg3}
StrCpy $prevcond "unchecked"
${EndIf}
${EndIf}
FunctionEnd
Yes thank you very much
An older thread, but FWIW and for future reference in case someone else is looking for related information, here is a complete script ... (btw, the top two lines from the earlier snippet are not actually necessary)
!include logiclib.nsh
Name "OneSectionLogiclib"
OutFile "OneSectionLogiclib.exe"
page components
page instfiles
var prevcond
SectionGroup /e "Group" SG
Section "SG1" sg1
SectionEnd
Section "SG2" sg2
SectionEnd
Section "SG3" sg3
SectionEnd
SectionGroupEnd
Function .onSelChange
${If} $prevcond != "checked"
${Unless} ${SectionIsSelected} ${sg1}
${If} ${SectionIsSelected} ${sg2}
${OrIf} ${SectionIsSelected} ${sg3}
!insertmacro SelectSection ${sg1}
${EndIf}
StrCpy $prevcond "checked"
${EndIf}
${Else}
${Unless} ${SectionIsSelected} ${sg1}
!insertmacro UnSelectSection ${sg2}
!insertmacro UnSelectSection ${sg3}
StrCpy $prevcond "unchecked"
${EndIf}
${EndIf}
FunctionEnd