Skip to content
⌘ NSIS Forum Archive

leave function in MUI

8 posts

Yathosho#

leave function in MUI

could not find this in the MUI docs (it should include some examples), how is the syntax for adding a leave function for the components page?
Mæster#
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "YourLeaveFunction"
!insertmacro MUI_PAGE_COMPONENTS

[EDIT]
*hehe*, just a few seconds later than Afrow, damn. 😁
Yathosho#
alright, i used the above function. my installer displays a warning when the user enables a sectiongroup including sections that delete files.
 Function compLeaveFunc
SectionGetFlags "${SecDelete}" $0
#MessageBox MB_OK "$0"
StrCmp $0 "2" End ; 2=none (?)
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "You have \
selected to delete some files, which can not be \
restored. Do you want to proceed?" IDYES End
Abort
End:
FunctionEnd
this only works partly. when i select one of the section and want to proceed, the warning pops up. selecting 'No' i get back to the components page. when i don't select any of the sections the warning keeps popping up. this only happens when i previously got a warning and not when i never selected on the sections.
Yathosho#
not sure what i'm doing wrong. what the BIT supposed to be in my example?
 Function compLeaveFunc
!insertmacro SectionFlagIsSet ${SecDelete} "2" Warning End

Warning:
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "You have \
selected to delete some files, which can not be \
restored. Do you want to proceed?" IDYES End
Abort

End:
FunctionEnd
the warning should popup when at least one subsection has been selected
Yathosho#
it works with SF_SELECTED when using it for every single section. i tried a combination of SF_SELECTED and SF_PSELECTED, but then the messagebox also showed up when nothing was selected. but this solution is good enough, thanks for the help!