Archive: Disappearing pages!


Disappearing pages!
Hi,

I've got two custom pages: the first to configure the database server and the second to configure the databases on the server.

All works fine, *except* that the server page disappears when clicking the back button on the second. It goes to the page before instead.

The code that is responsible for doing this appears to be to do with the function 'test_database_server'. This is called when the next button is clicked. If I comment out 'Call test_database_server', it works fine.


Function test_database_server
; Get server, password and username of database server
ReadINIStr $DBServer "$PLUGINSDIR\Database1.ini" "Field 1" "State"
ReadINIStr $DBUsername "$PLUGINSDIR\Database1.ini" "Field 4" "State"
ReadINIStr $DBPassword "$PLUGINSDIR\Database1.ini" "Field 5" "State"

ExecDos::exec "$PLUGINSDIR\osql.exe -b -S $\"$DBServer$\" -E -i $\"$PLUGINSDIR\nothing.sql$\""
pop $0

${If} $0 == "1"
MessageBox MB_ICONEXCLAMATION|MB_OK "Couldn't connect to database."
Abort
${Else}
MessageBox MB_OK "Database connection okay."
${EndIf}



Any idea how to fix this?


I'm not sure why the Leave function is being called when you click Back on the next page...
Please attach your entire script.

-Stu


This is the show and leave part of the first page:


Function show_database1_page
!insertmacro MUI_HEADER_TEXT "Main database setup" "Specify the following to connect to or create a SQL server."

InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\Database1.ini"

pop $hwnd
InstallOptions::show MUI_INSTALLOPTIONS_DISPLAY "Database1.ini"
pop $0

FunctionEnd

Function leave_database1_page

ReadINIStr $0 "$PLUGINSDIR\Database1.ini" "Settings" "State"
StrCmp $0 0 next ; Next button
StrCmp $0 6 testdb ; Test the current connection details
Abort

testdb:
; it doesn't disappear if you comment the line below out.
Call test_database_server

Abort
next:
; it doesn't disappear if you comment the line below out.
Call test_database_server


FunctionEnd


This is the show and leave part of the next page



Function show_database2_page
!insertmacro MUI_HEADER_TEXT "Choose three database names" "Select names for the required databases."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "Database2.ini"
FunctionEnd

Function leave_database2_page

ReadINIStr $0 "$PLUGINSDIR\Database2.ini" "Settings" "State"
StrCmp $0 0 next ; Next button
StrCmp $0 4 testdb ; Test the current connection details
Abort

testdb:
Call test_databases
Abort

next:
Call test_databases

FunctionEnd



Thanks for the help :)


Sorry, when I meant attach the entire script I meant attach your NSI file as a file attachment.

-Stu


Well, the whole installer is split into about 25 included nsh files (including the three above) and one nsi, which is attached.


Ah right. In that case, put a MessageBox before each Call test_database_server and see if you get one or both of them when clicking Back.

-Stu


Solved! And I got the database page to disappear altogether by rearranging my custom pages so that they all appeared in a row.

The problem was in the 'show' part of the custom pages:


!insertmacro MUI_HEADER_TEXT "Main database setup" "Specify the following to connect to or create a SQL server for Epro's main database."

InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\Database1.ini"

pop $hwnd
InstallOptions::show MUI_INSTALLOPTIONS_DISPLAY "$PLUGINSDIR\Database1.ini"
pop $0


If I replaced "InstallOptions::show MUI_INSTALLOPTIONS_DISPLAY "$PLUGINSDIR\Database1.ini" with just InstallOptions::show it didn't 'disappear' any pages.