nsisnsis-mui

How to make a SectionGroup mandatory in NSIS script


In an NSIS MUI script it is possible to make a section compulsory by adding "SectionIn RO" to the section. I would like to specify that the entire SectionGroup is compulsory. I know I can make each of the individual components compulsory which makes the group compulsory by default, but the SectionGroup checkbox is still enabled indicating that the user can turn it off. This could be confusing.

Is there an equivilent to "SectionIn RO" for SectionGroups and thus force the group's checkbox to be disabled?


Solution

  • I would say this is a NSIS bug. (If you decide to report this on the project tracker, you can reference this bug, it should have been fixed as part of that bug)

    Forcing the readonly flag seems to work:

    SectionGroup /e foo SecFoo
    Section bar
    SectionIn RO
    SectionEnd
    Section baz
    SectionIn RO
    SectionEnd
    SectionGroupEnd
    
    page components "" ForceHackyRO
    page InstFiles
    
    
    
    !include Sections.nsh
    
    Function ForceHackyRO
    !insertmacro SetSectionFlag ${SecFoo} ${SF_RO}
    FunctionEnd