Skip to content
⌘ NSIS Forum Archive

Make whole section group read-only?

6 posts

eagle3386#

Make whole section group read-only?

Hey guys,

I searched the docs, forums, wiki and even Google, but couldn't find an answer to my question: Is it somehow possible to make a whole (sub-) section group read-only?

For example
Root
+-[ ] A
I +-[ ] A1
I +-[ ] A2
I
+-[ ] B
I +-[ ] B1
I +-[ ] B2
I
+-[ ] C
is the structure - how to make B, B1 and B2 read-only?
Unfortunately, using "SectionIn RO" only works for B1 & B2..

Best regards,
Martin.. 🙂
eagle3386#
But where to set the flags? Within the specific section group? Within the .onInit-function? 🙂

BTW: Happy New Year! 🙂
{_trueparuex^}#
You can set the flags in any function before the components page is swon.

.onInit will work just fine:
!include Sections.nsh

...

SectionGroup "B" my_ro_group

; use "SectionIn RO" for subsections
Section "B1"
SectionIn RO
SectionEnd

...

SectionGroupEnd

Function .onInit
!insertmacro SetSectionFlag ${my_ro_group} ${SF_RO}
FunctionEnd
And a happy new year to you too. 🙂

PaR
eagle3386#
Ok, got the basic procedure from http://nsis.sourceforge.net/IfFileEx..._Section_Flags and the available flags from Sections.nsh's comments, _but_:

Normal flag value: 43
Read-only value: 59 (because SF_RO equals to 16)

Result (according to my scheme in post #1): "Root" gets read-only, A can still be unchecked and A1 & A2 are still read-only as before..

The code used
(...)
SectionGroup /e "!My Stuff"
SectionGroup /e "My App" myAPP
Section
(...)
SectionEnd
<more sections>
SectionGroupEnd
SectionGroup /e "!Extras" myXTS
<more sections>
SectionGroupEnd
SectionGroupEnd
(...)
Function ".onInit"
SectionSetFlags myAPP 59
FunctionEnd
(...)
Any help would still be greatly appreciated! 😉
eagle3386#edited
Okay, using "myAPP" instead of "${myAPP}" was the cause, so finally everything is just like expected, thanks to:

(...)
!include "Sections.nsh"
(...)
SectionGroup /e "!My Stuff"
SectionGroup "!My App" myAPP
<some sections>
SectionGroupEnd
(...)
SectionGroupEnd
(...)
Function ".onInit"
SectionSetFlags ${myAPP} 27 # equals to "SF_SELECTED (1) && SF_SECGRP (2) && SF_BOLD (8) && SF_RO (16)"
FunctionEnd
(...)
Again, thanks _a lot_, Animaether and trueparuex! 🙂

Best regards,
Martin..