Archive: Pages limited to conditions


Pages limited to conditions
  How do I make pages that only show up if certain conditions are met?
I want to make a page which allows you to select between 3 different pages (only one of them can be selected). Also, none of this page pops up if a registry entry exists.
A page structure like in the attached image.
Also, how do I make sections selectable through a InstallOptions page (using checkboxes) instead of the Components page?


Hi SupSuper :)

1) About the conditionnal pages, you just have to use the callback functions to skip the page or not, using the instruction "abort".

From the doc:

4.5.3 Callbacks

Each built-in page has three callback functions. The pre-function, the show-creation function and the leave-function. The pre-function is called right before the page is created, the show-function is called right after it is created and before it is shown and the leave-function is called right after the user has pressed the next button and before the page is left.

* The pre-function allows you to skip the page using Abort.
* The show-function allows you to tweak the page's user interface with CreateFont, SetCtlColors, SendMessage and others.
* The leave-function allows you to force the user to stay on the current page using Abort.

A custom page only has two callback functions, one that creates it which is mandatory, and one leave-function that acts just like the leave-function for built-in pages.
Your can find an example from the doc here:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.5.3


2) About the "sections selectable", could you be more precise? Why don't you want to use the built-in component page?


evilO/Olive

1) much thanks :)

2) i still use the components page, but i want some components (sections) only selectable through one of the custom pages (thus i made them hidden so they don't show up in the components page). so how can i enable/disable them without using that page? is there some function to do it?
this is the custom page i'm going to use to select them.


Hum, I looked at your page, looked again on your installer structure, and well I'm not sure to really get the logic of it... :weird:

You have some sections in the component page that are just selectable there, and you have some sections that are hidden in the component page but that are selectable later on in your custom pages...

Am I right ?


Well, in that case you could use that code:

- to select a section


Push $R0

SectionGetFlags section_index $R0
IntOp $R0 $R0& ${SF_SELECTED}
>SectionSetFlags section_index $R0
Pop $R0
>
- to deselect a section

Push $R0      

SectionGetFlags section_index $R0
IntOp $R0 $R0& ${SECTION_OFF}
>SectionSetFlags section_index $R0
Pop $R0
>
I hope that is what you asked for :D

evilO/Olive

Originally posted by evilO
Hum, I looked at your page, looked again on your installer structure, and well I'm not sure to really get the logic of it... :weird:
it's pretty simple, actually. the page the components are selectable on is only displayed if the program's not installed. if the program's already installed (thus upgrading it) it doesn't make sense for the user to need to install those components. if they were all in the Components page they'd always be displayed. besides, it's more organized this way ;)

Originally posted by evilO
You have some sections in the component page that are just selectable there, and you have some sections that are hidden in the component page but that are selectable later on in your custom pages...

Am I right ?
yep
Originally posted by evilO
Well, in that case you could use that code:

- to select a section

Push $R0

SectionGetFlags section_index $R0
IntOp $R0 $R0& ${SF_SELECTED}
>SectionSetFlags section_index $R0
Pop $R0
>
- to deselect a section

Push $R0      

SectionGetFlags section_index $R0
IntOp $R0 $R0& ${SECTION_OFF}
>SectionSetFlags section_index $R0
Pop $R0
>
I hope that is what you asked for :D

evilO/Olive
ummm... it doesn't work. this is what i get:
2 warnings:
unknown variable/constant "{SF_SELECTED}" detected, ignoring (stdin:317)
unknown variable/constant "{SECTION_OFF}" detected, ignoring (stdin:326)

it's pretty simple, actually.
...
besides, it's more organized this way
Yes, once you've got the full explanation it's a lot easier ;)

ummm... it doesn't work. this is what i get:
2 warnings:
unknown variable/constant "{SF_SELECTED}" detected, ignoring (stdin:317)
unknown variable/constant "{SECTION_OFF}" detected, ignoring (stdin:326)
Oooops, I forgot to tell you to add this:

!include Section.nsh

Sorry about that... It should work now :)


evilO/Olive

Originally posted by evilO
Oooops, I forgot to tell you to add this:

!include Section.nsh

Sorry about that... It should work now :)


evilO/Olive
actually it's Sections.nsh ;)

anyways thanks it works now :D

Oooooops again :o

Well, sorry for the typo, for once I didn't copy/paste :p

Anyway I'm glad it worked :)

evilO/Olive