benjohnson
7th September 2011 12:52 UTC
Dialogs - go to certain pages
Hi All,
Having a bit of trouble getting along with nsDialogs. I want a page to show up at the start (no trouble) and then only display a certain page if a specific button is pressed.
My code will become quite complex at the end with lots of different pathways depending on what you click so I thought I would start off simple but I can't get it going. I've attached my code. The code compiles OK but when I run the file and press the button I get 'Dialogs.exe has stopped working'.
I want to use nsDialogs because it gives lots of control over the layout.
I'm sure that I'm doing something daft, I started from the examples but may be trying to do things the wrong way.
Thanks for any help.
Cheers,
Ben
Afrow UK
7th September 2011 14:25 UTC
You can't show a nsDialogs page just by calling a show function. It doesn't work that way.
http://nsis.sourceforge.net/Go_to_a_NSIS_page
Stu
benjohnson
7th September 2011 15:01 UTC
Great, thanks, I knew I was doing something daft.
So using RelGotoPage will take me forward or back a number of pages by using certain number, is there anyway to do it by name?
Anders
7th September 2011 16:06 UTC
Originally posted by benjohnson
Great, thanks, I knew I was doing something daft.
So using RelGotoPage will take me forward or back a number of pages by using certain number, is there anyway to do it by name?
Name? Pages don't have names (You can use a page type multiple times)
benjohnson
7th September 2011 16:47 UTC
Each nsDialog page has a name though, is there any way to jump to those particular pages?
MSG
7th September 2011 17:45 UTC
No, you can only make relative jumps. What you can do is add a !define page_components 1 etc for each page, and then calculate the relative distance by subtracting the two defines. This way whenever you change the page order, or add/remove pages from your script, you only need to make changes to the defines, not to every single page jump command in your script.
Anders
7th September 2011 22:57 UTC
Originally posted by benjohnson
Each nsDialog page has a name though...
No?
benjohnson
16th September 2011 12:41 UTC
Solution, kind of
Just thought I would update how I managed to solve this in case it might help someone else.
I put a bit of code in before I created my nsDialogs page which would abort the page if a value wasn't met, it would then move on to the next one. It was a bit of a bodge, but it did the trick.
Function PageName
${If} $pageRequested != "PageName" ; if $pageRequested doesn't match the title of the page, don't show the page, move onto next page.
Abort
${EndIf}
nsDialogs::Create 1018
.....
I would use StrCpy to define the variable before loading the next page, using the page Leave function.