Archive: InstallOptions in a Section, not a Page


InstallOptions in a Section, not a Page
  Hi everyone (and NSIS coders in particular :) )

InstallOptions crashes for me in NSIS 2beta0. Specifically, it appears to work until I click a button at the bottom of the dialog. Searching the forum, I found this thread, which indicates that I can only use InstallOptions inside a Page, not a Section.

However, I only want the dialogs to appear when the user has chosen a particular item. While I could fudge around with Pages and global variables, it would make the script a lot messier. My current solution is to use the InstallOptions.dll from NSISv1.98 in my NSISv2 script. It works fine within a Section.

However, I'd prefer to migrate entirely to NSISv2's InstallOptions. I was wondering if anyone knows why the v1 InstallOptions works within a Section, but the v2 InstallOptions doesn't.. and if it would be possible to hack the v2 DLL around so it once again works inside a Section.

I've done a diff of the source for both versions, but there's too much in there for me to spot this particular difference. Anyone able to throw me a bone? :)

Thanks, Andrew.


You can skip the page if the user has not selected the section.


As Joost said you can use:


PageFunc

SectionGetFlags${MySec} $0
IntOp$0 $0 & ${SF_SELECTED}
StrCmp $0 ${SF_SELECTED} 0 skipPage
# show page here...
skipPage
FunctionEnd
>
If you don't want to use this way and still want to change InstsallOptions source then you'll have to revive ParentWndProc and cfgDlgProc.

Using pages is also useful because the buttons will have the right texts.


And don't forgot to add:

!include "Sections.nsh"


Thanks guys, I'll take a look at both options.


is there an example how to use this?


Use the code as pre function for the page. If the section has not been selected, the page will be skipped.


i put together the results of private chats with kichik and joost. an example based on the original InstallOptions.nsi can be found here.