Archive: Required section in MUI?


Required section in MUI?
I'm a biologist and part-time programmer using NSIS 2.0 w/MUI for my project. So far, so good, but two questions:

1. When I use a components page, how do I indicate that some sections MUST be installed (cannot be unchecked)?

2. Also, is there any way to specify the default destination when using a second Directory page (to get the directory for other components)? I mean something like:

!define MUI_DIRECTORYPAGE_DEFAULTFOLDER "$DOCUMENTS"

which is not a valid statement.

Thanks to all.


OK, I reply to my own post, as I figured out that SectionIn can apply even with the MUI.

Question #2 still remains....

MHP


Set a value in the directory variable (using StrCpy) which you have set using MUI_DIRECTORYPAGE_VARIABLE.


Thanks! I tried your answer, using this code:

!define MUI_PAGE_HEADER_TEXT "Choose Folder for Shortcut."
StrCpy $CMDdir "$DOCUMENTS"
!define MUI_DIRECTORYPAGE_VARIABLE $CMDdir
!insertmacro MUI_PAGE_DIRECTORY

but the compiler gives this error message:

Error: command StrCpy not valid outside section or function

Since the page macros are inserted before any sections, I don't know how to make this work. Can you help?


You should note the difference between compile-time and run-time.

All defines and macros are processed on compile-time, so you can't use any run-time commands for their settings.

Put the StrCpy line in a function called .onInit


Thank you again. Using the .onInit function was the technique I needed.

I really appreciate being able to use NSIS and the MUI. Together, they have made my software much easier for inexperienced users to install and use.