Archive: components&custompage


components&custompage
Hi all!
I'm rather newbie with nsis, I need some help..
I got 3 (Install options) custompage.
I'd like my installer show them only when a certain components on components page is chose.
How can I do this?

Here it's what I understand:
I can make a (pre)function before inserting macro (!insertmacro MUI_INSTALLOPTIONS_DISPLAY "config1.ini")
but what is the parameter that I've to control? what is the flag components set if a component is checked?
Thank's in advance..
dilox


test, do not read


I use a PRE page after the COMPONENTS page to set some variables - then I just check the variables later on to make decisions like "should I show this page?".

After the components page, there is the SetComponentVariables PRE function - focus here.
...
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_CUSTOMFUNCTION_PRE SetComponentVariables
!insertmacro MUI_PAGE_DIRECTORY
...

In this SetComponentVariables function, add things like this:

!insertmacro SectionFlagIsSet ${Section1} ${SF_SELECTED} it_is it_is_not

it_is:
StrCpy $vSection1 "yes"
it_is_not:
StrCpy $vSection1 "no"

Then later, just use a StrCmp or some ${If} $vSection1 == "yes" logic.

-Coho


give your sections a section index then use.

SectionGetFlags ${your index} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show
Abort

show:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "your.ini"


Thank's a lot both coho and razor!
I find razor explanation very good.. I wasted some times because I didn't include Section.nsh so ${SF_SELECTED} was always undefined.
Now I've included it and everything works fine!
Thank's again, bye!