Archive: Dynamically set "Required Section"?


Dynamically set "Required Section"?
Hi,

I want to conditionally set a section as "required" (user shouldn't be able to deselect it) depending upon runtime conditions. So for example in my .onInit function, I will verify whether the user already have a JRE installed or not and if he does not, I want the JRE installation to be a required section.

So far I found that adding "SectionIn R0" is supposed to make a section required, but this occurs at compile-time. Is there a way to set this flag at runtime?

Thanks,
Gili


You can use SectionSetFlags instruction:

the fifth bit represents whether the section is read-only
So you must set this bit if JRE is not installed, and clear it if installed.

glory_man,

Care to elaborate? Are you saying this is configurable using SectionSetFlags? The documentation does not mention "section is required" as one of the possible bits you can set.

Gili


Oops, is this the fifth bit?

"the fifth bit represents whether the section is read-only"

Does "read-only" mean the same thing as "required"?

Thanks! :)
Gili


There are no required sections in NSIS. All required sections are present in author's head. "SectionIn R0" set read-only attrib for section. So if you want to create "required" section you can make it read-only (user cann't change it status).


Originally posted by glory_man
There are no required sections in NSIS. All required sections are present in author's head. "SectionIn R0" set read-only attrib for section. So if you want to create "required" section you can make it read-only (user cann't change it status).
Makes sense. Thanks a lot!
Gili