Archive: show page according to section


show page according to section
Hello forum.

I've created a script with several custom pages. One of them is:

Page custom UserCredentialsPage UserCreadentialsPageLeave


And several sections, one of them is:


Section "Licence"
...
SectionEnd


, that retrives via a webservice the licence. The problem is that, I need UserCreadenticalsPage page isn't showed if this section isn't selected.

How can I set that NSIS doesn't show my custom page if a section isn't selected?

Thanks for all.

Call abort in the page's pre-function to skip that page from being displayed - check section flags to see if the section was selected or not. Use LogicLib to make all this a lot easier.


Section "License" LicenseSectionName
...
SectionEnd

Function UserCredentialsPage
${Unless} ${SectionIsSelected} LicenseSectionName
Abort
${EndUnless}
FunctionEnd

I've written it:


Page custom UserCredentialsPage UserPageLeave



Function UserCredentialsPage
${Unless} ${SectionIsSelected} LicenseSection
Abort
${EndUnless}
nsDialogs::Create /NOUNLOAD 1018
Call setApparence
Pop $Dialog

${If} $Dialog == error
Abort
${EndIf}

Call UIUser

nsDialogs::Show
FunctionEnd

Function UIUser
${NSD_CreateLabel} 0 0 100% 12u "..."
Call setApparence
Pop $UserLabel

${NSD_CreateLabel} 15% 15% 15% 12u "Usuario: "
Call setApparence
Pop $UserLabel

${NSD_CreateText} 30% 15% 60% 12u $User
Pop $UserText

${NSD_CreateLabel} 15% 30% 15% 12u "Password: "
Call setApparence
Pop $PasswdLabel

${NSD_CreatePassword} 30% 30% 60% 12u $Passwd
Pop $PasswdText

${NSD_CreateLabel} 15% 45% 15% 12u "E-Mail: "
Call setApparence
Pop $MailLabel

${NSD_CreateText} 30% 45% 60% 12u $Mail
Pop $MailText
FunctionEnd



Section "Licencia/Demo" LicenseSection
...
SectionEnd


But it doesn't work. After I've unselected LicenseSection, UserCreadentialsPage is showed.
What Am I do wrong?

Make sure the section is defined above your function and it should be ${LicenseSection} for your SectionIsSelected check.

Stu


darn edit limitation...

so my earlier example should have been:


; write your sections first!
; Give your sections a name that you can reference easily
Section "License" LicenseSectionName
...
SectionEnd

; and your functions later, so it can find the defined sections!
; refer to the section by name
Function UserCredentialsPage
${Unless} ${SectionIsSelected} ${LicenseSectionName}
Abort
${EndUnless}
FunctionEnd

Ok, it works fine.
Thanks for all.