Archive: Callback function with an InstallOptions page


Callback function with an InstallOptions page
I've created a custom page using the InstallOptions plugin. I'm trying to attach a custom callback function to the page, but I'm having problems getting the callback to work. (Basically, I want to stay on my custom page until certain conditions are met.)

Nothing I've tried has made the custom callback function work. The callback works fine using the pre-defined MUI screens, but not in my custom page. I haven't been able to find any good examples of how to use custom callbacks on an InstallOptions page.

Look at the function 'CusFuncB' in the following example


!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\blue.ico"
!define MUI_PAGE_HEADER_TEXT $Header1
!define MUI_Page_HEADER_SUBTEXT $Header2
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Select directory:"
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ${PRODUCT_NAME} Version ${PRODUCT_VERSION} setup Wizard"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Customer Number page
Page custom CustomPageA
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_PRE GetCusNumber
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VerifyMyDir
!define MUI_DIRECTORYPAGE_TEXT_TOP "Install Package blah"
!insertmacro MUI_PAGE_DIRECTORY

; Custom Page:

; ******** HERE'S THE FUNCTION THAT DOESN'T WORK *******
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CusFuncB

Page custom CustomPageB
; Finish page
!insertmacro MUI_PAGE_FINISH

LangString TEXT_IO_TITLE ${LANG_ENGLISH} $Header1
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} $Header2

Function CustomPageA
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioEnterNumber.ini"

FunctionEnd

Function CustomPageB
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioSelectLogo.ini"

FunctionEnd

Function CusFuncB
; some function - blah blah blah
FunctionEnd


Anyone out there have any tips/examples/etc.?

use

Page custom CustomPageEnter CustomPageLeave

sometimes it's very useful to have a look at the docs ...

I was so focused at looking all over the MUI and InstallOptions docs that I completely missed the Page command of the regular NSIS help files!

Thanks for your help Comm@nder21!