Skip to content
⌘ NSIS Forum Archive

Need help with Components page leave function

6 posts

dejano#

Need help with Components page leave function

Is there any example how use Modern UI leave function on Components page ?
dejano#
Have components page without mandatory section selected.
I don't alow user leave components page if anything is select.
Comm@nder21#
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE <LeaveFunctionName>
!insertmacro MUI_PAGE_COMPONENTS

[...]

Function <LeaveFunctionName>
[...]
FunctionEnd
but why do u have a componentspage, if nothing sould be selected????
or do u mean, that just not _everything_ should be selected?
kichik#
Use the SectionFlagIsSet macro in Include\Sections.nsh (!include "Sections.nsh") along with the SF_SELECTED flag to check if a certain section is selected. For example:
!insertmacro SectionFlagIsSet ${section1} ${SF_SELECTED} selected notselected
selected:
MessageBox MB_OK "section 1 is selected"
Goto done
notselected:
MessageBox MB_OK "section 1 is NOT selected"
done:
dejano#
In my components page, some sections are disabled depends on detection if other programs installed on this computer. User may install all components which are enabled or only one enabled component. I don't allow user leave components page if nothing is selected.

comm@nder21 code works fine for me. Thanks a lot.