Archive: Custom page not displaying


Custom page not displaying
I am trying to allow a user to select to install one of two versions, if they select version 1 then a certain custom page is displayed, version 2 and another custom page is displayed. My code is below..........

;Page1
Page custom intropage
Function intropage
#Display the page
!insertmacro INSTALLOPTIONS_DISPLAY "intropage"
FunctionEnd

;TypeSelect
Page custom typeselect typeselectleave
Function typeselect
#Display the page
!insertmacro INSTALLOPTIONS_DISPLAY "typeselect"
FunctionEnd

Function typeselectleave
!insertmacro INSTALLOPTIONS_READ $R1 "typeselect" "Field 3" "State"
!insertmacro INSTALLOPTIONS_READ $R2 "typeselect" "Field 4" "State"
${If} $R1 == 1
!insertmacro INSTALLOPTIONS_DISPLAY "version1"
${EndIf}
${If} $R2 == 1
!insertmacro INSTALLOPTIONS_DISPLAY "version2"
${EndIf}
FunctionEnd


For some reason the custom page isnt being displayed when the user selects the option. I know the process is working because if I throw a message box in instead of the INSTALLOPTIONS_DISPLAY it works.

How come my custom page call isnt working within the if statement?

I think you need to point to the ini file, not the name of the page. But InstallOptions has been deprecated for a very long time, you really should switch to nsDialogs as soon as possible.


Besides the comments from MSG, you can only call INSTALLOPTIONS_DISPLAY from the page show function.
So you need to move the code from the typeselectleave function to the show function of the pages 'version1' and 'version2':

Page custom version1
Page custom version2

Function version1
!insertmacro INSTALLOPTIONS_READ $R1 "typeselect" "Field 3" "State"
${If} $R1 == 1
!insertmacro INSTALLOPTIONS_DISPLAY "version1"
${EndIf}
FunctionEnd

Function version2
!insertmacro INSTALLOPTIONS_READ $R1 "typeselect" "Field 4" "State"
${If} $R1 == 0
!insertmacro INSTALLOPTIONS_DISPLAY "version2"
${EndIf}
FunctionEnd

Thank for the input, I didn't realise you couldnt call the macro in a leave function.

This is my last project using installoptions! I promise :)

Learning nsDialogs for my next one!