I understand to validate a custom page, I am to retrieve the value of success, back, cancel, error, etc. I have the code working properly as follows:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
exitVideoInstall:
push $5
!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "ioB.ini"
Pop $5
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "ioB.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R5 "ioB.ini" "Field 6" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R3 "ioB.ini" "Field 9" "State"
;;Check for proper directory names. If a directory has a "\" at the end of it, remove the "\"
strcpy $6 $R2 1 -1
strcmp $6 "\" "" +2
strcpy $R2 $R2 -1 ;Remove "\"
strcpy $6 $R5 1 -1
strcmp $6 "\" "" +2
strcpy $R5 $R5 -1 ;Remove "\"
strcpy $6 $R3 1 -1
strcmp $6 "\" "" +2
strcpy $R3 $R3 -1 ;Remove "\"
;Check to make sure each directory has a ":" as the second character
strcpy $6 $R2 1 1
strcmp $6 ":" "" abortMyPage
strcpy $6 $R5 1 1
strcmp $6 ":" "" abortMyPage
strcpy $6 $R3 1 1
strcmp $6 ":" exitPage abortMyPage
abortMyPage:
;Do pop up window if next button is pushed
strcmp $5 "success" "" exitPage
MessageBox MB_ICONEXCLAMATION|MB_OK 'Your directories must exist on local drives or your \
network drives must be mapped to a drive letter. All \
drives must begin "Z:\" where Z is an appropriate drive \
letter.'
goto exitVideoInstall
exitPage:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
My problem is that when the MessageBox appears, the contents on the screen behind the MessageBox disappear. Is there a way to keep the contents in the custom page appearing behind the MessageBox window; similar to what happens when the Cancel button is pushed?
Keeping Window Contents Visible
9 posts
If you use a "leave" function for your custom page and do the validation in the "leave" function then the message box generated by the "leave" function will appear on top of the custom page (so you can still see the custom page contents).
You need to be using NSIS 2.0b4 in order to be able to use a custom page "leave" function.
You need to be using NSIS 2.0b4 in order to be able to use a custom page "leave" function.
How to set up?
How would I set up the code for that? Is it similar to the standard LEAVE, SHOW, and PRE set up?
Once set up, how do I return to the page if validation fails or continue if validation is successful?
Also, where would I get the latest version NSIS 2.0b4?
How would I set up the code for that? Is it similar to the standard LEAVE, SHOW, and PRE set up?
Once set up, how do I return to the page if validation fails or continue if validation is successful?
Also, where would I get the latest version NSIS 2.0b4?
Hopefully these simple code fragments will give you some hints about how to use a leave function with a custom page.
When listing the pages for your installer, specify a "leave" function for the custom page:
You can download the latest CVS snapshot from http://nsis.sourceforge.net/nightly/nsis.zip
When listing the pages for your installer, specify a "leave" function for the custom page:
In your custom page function, display the custom page:!insertmacro MUI_PAGE_DIRECTORY
Page custom MyCustomPage "MyLeaveFunction"
Use the "leave" function to do your input validation:Function MyCustomPage
; Display the custom page
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "demo.ini"
FunctionEnd
Hope this helps.Function MyLeaveFunction
Push $R9
Push $R8
!insertmacro MUI_INSTALLOPTIONS_READ $R9 "demo.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R8 "demo.ini" "Field 4" "State"
StrCmp $R9 $R8 bad_data good_data
bad_data:
MessageBox MB_OK|MB_ICONEXCLAMATION "Input values cannot be the same"
; Stay with the custom page created by "MyCustomPage"
Pop $R8
Pop $R9
Abort
good_exit:
; Allow next page in the installation sequence to be shown
Pop $R8
Pop $R9
FunctionEnd
You can download the latest CVS snapshot from http://nsis.sourceforge.net/nightly/nsis.zip
Leave seems to be PRE
When I put a MessageBox (just for checking purposes) in my validating function that is supposed to trigger when the user leaves the custom page, the MessageBox pops up upon coming into the page, not upon leaving it. It appears to be a PRE trigger and not a LEAVE trigger. Is this an error?
When I put a MessageBox (just for checking purposes) in my validating function that is supposed to trigger when the user leaves the custom page, the MessageBox pops up upon coming into the page, not upon leaving it. It appears to be a PRE trigger and not a LEAVE trigger. Is this an error?
Leave seems to be PRE
When I put a MessageBox (just for checking purposes) in my validating function that is supposed to trigger when the user leaves the custom page, the MessageBox pops up upon coming into the page, not upon leaving it. It appears to be a PRE trigger and not a LEAVE trigger. Is this an error?
When I put a MessageBox (just for checking purposes) in my validating function that is supposed to trigger when the user leaves the custom page, the MessageBox pops up upon coming into the page, not upon leaving it. It appears to be a PRE trigger and not a LEAVE trigger. Is this an error?
If you want to display a message box when you leave the custom page, you can put it in the custom page function, after the MUI_INSTALLOPTIONS_DISPLAY (or MUI_INSTALLOPTIONS_DISPLAY_RETURN if that is what you are using).
The "Good-bye" message box should be seen after "good" data has been entered (i.e. if the "leave" function exits normally, without using the "Abort" command).Function MyCustomPage
; Display the custom page
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "demo.ini"
MessageBox MB_OK "Good-bye"
FunctionEnd
Thanks
What happened was I put the leave callback function on the custom page right before the custom page that I wanted to insert it onto, thus, making it appear as though the function was being called as a pre callback.
It works fine now. Thanks much for your input.
What happened was I put the leave callback function on the custom page right before the custom page that I wanted to insert it onto, thus, making it appear as though the function was being called as a pre callback.
It works fine now. Thanks much for your input.
Glad I was able to help.