diff --git a/Contrib/InstallOptions/Readme.html b/Contrib/InstallOptions/Readme.html index e145f439..de51a5e2 100644 --- a/Contrib/InstallOptions/Readme.html +++ b/Contrib/InstallOptions/Readme.html @@ -423,7 +423,10 @@ FunctionEnd

Call the DLL

You can call InstallOptions in a page function, check the NSIS documentation -for information about the page system.

+for information about the page system. Example:

+
+Page custom SetCustom ValidateCustom
+

The InstallOptions DLL has three functions:

Usually, you only need to use the dialog function:

-Function FunctionName ;FunctionName defined with Page command
+Function SetCustom ;FunctionName defined with Page command
 
   ;Display the Install Options dialog
 
@@ -441,6 +444,27 @@ Function FunctionName ;FunctionName defined with Page command
   InstallOptions::dialog $PLUGINSDIR\test.ini
   Pop $R0
 
+FunctionEnd
+
+

Get the input

+

To get the input of the user, read the State +value of a Field using ReadINIStr:

+
+ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
+
+

Validate the input

+

If you want to validate the input on the page, +for example, you want to check whether the user has filled in +a textbox, use the leave function of the Page command and Abort +when the validation has failed:

+
+Function ValidateCustom
+
+  ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
+  StrCmp $0 "" 0 +3
+    MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name."
+    Abort
+    
 FunctionEnd
 

Return value

@@ -458,12 +482,6 @@ the example above).

If you want to check the user input immidiately, for example, to display a warning when the input is invalid, you should check whether the user has pressed the Back or Next button.

-

Get the output

-

In most cases, you will need the output from the INI File -in a section. Get it using ReadINIStr:

-
-ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
-

ReserveFile

It you are using BZIP2 compression and your .onInit and Page functions are not above all other sections/functions with File commands, use diff --git a/Contrib/InstallOptions/test.nsi b/Contrib/InstallOptions/test.nsi index 22958d97..6e1e5c62 100644 --- a/Contrib/InstallOptions/test.nsi +++ b/Contrib/InstallOptions/test.nsi @@ -21,7 +21,7 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll" ReserveFile "test.ini" ;Order of pages -Page custom SetCustom VerifyCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom. +Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom. Page instfiles Section "Components" @@ -64,14 +64,19 @@ Function SetCustom FunctionEnd -Function VerifyCustom - ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State" - StrCmp ${TEMP1} 1 done - ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State" - StrCmp ${TEMP1} 1 done - ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State" - StrCmp ${TEMP1} 1 done - MessageBox MB_ICONSTOP|MB_OK "You must select at least one install option!" - Abort - done: +Function ValidateCustom + + ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State" + StrCmp ${TEMP1} 1 done + + ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State" + StrCmp ${TEMP1} 1 done + + ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State" + StrCmp ${TEMP1} 1 done + MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!" + Abort + + done: + FunctionEnd \ No newline at end of file