Archive: Turn off sections on runtime


Turn off sections on runtime
Turn off sections on runtime



I have a problem :
Section "VerifyEnvironment"
${If} $CommandLine == '/admin'
messageBox MB_OK "/admin"
${Else}
SectionIn RO
${EndIf}

CommandLine is "/admin" but section is read-only!If i continue install the messageBox is show!!!:confused:
Please help!:up:


SectionIn is not a run time instruction therefore you section will be disabled unconditionally.

Are you trying to unselect the section or make it read only? To unselect it, use the UnselectSection macro in Sections.nsh. To make it read only, use the SetSectionFlag macro with ${SF_RO}.

Note: These must be done prior to the Components page.

Stu


i have:
SectionGroup "Prerequisits (Required)" sec

Section "VerifyEnvironment" sec1
......
and i use :
insertmacro SetSectionFlag ${sec} ${SF_RO}
!insertmacro SetSectionFlag ${sec1} ${SF_RO}
!insertmacro SetSectionFlag ${sec2} ${SF_RO}

and the results is - only SectionGroup is read-only!!:confused: and i can make it check box 1/0(mark or unmark) with sec1,sec2 ....


please help!


Where have you put this code? As I have already said, you need to use it before the components and instfiles pages. That could be in .onInit or a page PRE function.

Stu


And the code has to be *below* the section defines - otherwise the ${sec1} - ${secN} values are not defined. Not defined is like "0" which is probably the value of ${sec} and explains how the group gets turned into RO.


Originally posted by demiller9
And the code has to be *below* the section defines
Now is ok!10x!