I have a page as below:
And the EnterCustom function:Page EnterCustom LeaveCustom
The Installer.ini features a DirRequest as the 3rd field:
Function EnterCustom
File /oname=$PLUGINSDIR\installer.ini "@CMAKE_CURRENT_SOURCE_DIR@\installer\installer.ini"
StrCpy $0 "$PLUGINSDIR\installer.ini"
Call CreateDialogFromINI
FunctionEnd
And the LeaveCustom function:
[Field 3]
Type=DirRequest
Left=10
Right=-10
Top=32
Bottom=44
Text=Select directory:
State=
As you see, after the user provides a directory (either by manually typing it or by selecting it using the '...' button), the scripts checks to make sure there are JPG files available in that directory. If not, it will prompt the user to enter another/valid directory.
Function LeaveCustome
Call UpdateINIState
ReadINIStr $Dir1 "$PLUGINSDIR\installer.ini" "Field 3" "State"
FindFirst $0 $1 "$Dir1\*.jpg"
StrCmp $1 "" 0 AllGood
MessageBox MB_OK|MB_ICONEXCLAMATION "The directory is not valid. Please try again."
Abort
AllGood:
FunctionEnd
Now the problem: If the user enters a valid directory the first time, it all works great. But if the user enters something invalid, let's say "qwerty", the error message is shown and the Abort happens, but the $Dir1 variable always keeps the 'qwerty' value even if users enters some other data afterwards. So if after the error message user types 'lkjh' in that box, $Dir1 still reads 'qwerty'. Also, if at this stage user presses the '...' button and chooses a directory, not only $Dir1 stays 'qwerty', but also even the text box on the screen stays 'qwerty'.
Can you please tell me what I am doing wrong? Thanks.