Archive: Catch Button Event


Catch Button Event
  Hi.

First of all: I'm new to NSIS.

I edited an installation script of our company. I inserted a new customized MUI Page. There you can input two file names, looking like this:


PAGE_PRIVATE_KEY

START_PAGE_PRIVATE_KEY:
!
insertmacro MUI_HEADER_TEXT "Private Key" "Wählen Sie hier den privaten Schlüssel aus."
;!insertmacro MUI_INSTALLOPTIONS_WRITE "PAGE_PRIVATE_KEY.ini" "Field 3" State "config\keys\mycert.key"
;!insertmacro MUI_INSTALLOPTIONS_WRITE "PAGE_PRIVATE_KEY.ini" "Field 5" State "config\keys\mycert.crt"
!insertmacro MUI_INSTALLOPTIONS_WRITE "PAGE_PRIVATE_KEY.ini" "Field 8" State "$INSTDIR\config\keys"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "PAGE_PRIVATE_KEY.ini"

!insertmacro MUI_INSTALLOPTIONS_READ $private_key "PAGE_PRIVATE_KEY.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $private_cert "PAGE_PRIVATE_KEY.ini" "Field 5" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $private_dir "PAGE_PRIVATE_KEY.ini" "Field 8" "State"


call CheckPrivateKey
StrCmp $return"false" 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "$error"
goto START_PAGE_PRIVATE_KEY

call CheckPrivateCert
StrCmp $return"false" 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "$error"
goto START_PAGE_PRIVATE_KEY



FunctionEnd
>

$return is a global var. after reading some examples I know that it could be done better/another way (stack).

My question: how can I depend the Checkxxx functions on a button event? currently the script calls the function even if you want to go back or abort the installation. that's not very user friendly, because you have to input those file names although you just want to abort.

You have to do do validation in the Custom Page's Leave function:

Page Custom showFunc leaveFunc

In fact the way that you are doing it now will not work at all, because InstallOptions only saves data from the InstallOptions page to the INI file after you leave the page (when you reach the Leave function).

-Stu


It works.

Thank you!!


have to learn more about nsis, i think it's great ;)