langdon
1st September 2011 22:46 UTC
Skipping a custom Page
This crashes when it hits Page 3 because of the Abort inside of Page2.
Name nsDialogs
OutFile nsDialogs
.exe
>!Include nsDialogs.nsh
Page custom nsDialogsPage1
Page custom nsDialogsPage2
Page custom nsDialogsPage3
Page instfiles
>Function nsDialogsPage1
nsDialogs::Create 1018
nsDialogs::show
FunctionEnd
>Function nsDialogsPage2
nsDialogs::Create 1018
Abort
nsDialogs::show
FunctionEnd
>Function nsDialogsPage3
nsDialogs::Create 1018
nsDialogs::show
FunctionEnd
Section
DetailPrint "hello world"
>SectionEnd
>
In my real world example, I've got a prerequisites page that runs and does a bunch of validation. If there are no errors at the end of my prerequisite validation, I'm calling Abort to (1) skip that page, (2) go on to the next one, (3) disable the back button. If there ARE errors, the page displays the errors and won't let the user proceed until everything is resolved (server config, etc).
It doesn't seem like I'm doing anything wild here. Is there another way to go about this?
Yathosho
1st September 2011 23:44 UTC
have you tried aborting before creating the dialog?
langdon
2nd September 2011 01:36 UTC
Ahh dang, that seems to work.
I've got an order of operations problem then. I'm creating a ListBox on that custom page and filling it with any issues that arise from my validation. At the end of the function, I SendMessage LB_GETCOUNT, and if I get 0 back, I Abort to proceed onto the next step.
Is there a better place I can store these issues (just strings of text) and then if there are any, render the interface and fill the list? It seems like the NSISArray or nsArray might work, but perhaps there's something more appropriate?
Shame this scenario just crashes the installer. I feel like what I've written is really clean and straight forward. I wonder if I could just free up whatever nsDialogs::Create created?
MSG
2nd September 2011 06:08 UTC
You could also do the validation twice, first time only increment an integer counter. When it's larger than zero, you can do it again and populate the listbox.
demiller9
2nd September 2011 07:21 UTC
Is there a better place I can store these issues (just strings of text) and then if there are any, render the interface and fill the list?
First idea - If the list isn't extremely long, use the stack. Just Push the string (you should start with a marker to recognize the end when you are retrieving them) and when you finish validating all components, Pop the strings back and add them to the ListBox. If the first Pop gives you your marker, your list was empty. (This method will reverse the strings, LIFO).
Second idea - write the text to a tempfile in $PlugInsDir. When you go to read the file, if it's empty the listbox will be, too. (This method maintains the order, FIFO).
Don
langdon
7th September 2011 18:43 UTC
Thanks for all the input. I ended up using NSISArray to push issues into my own array. After running all my checks, I called SizeOf. If there were any issues, I created the custom page, called Reverse on the array, and filled the listbox with items from the array (in the order they happened).
Still, calling Abort at the end of the page to hide the Back button on the 2nd page closed or crashed the app if the user hit back, so I ended up using Buttons Header to hide the Back button when the 2nd page was created.
Shitty work around, but it does work like I want now.