Skip to content
⌘ NSIS Forum Archive

Dialogs - go to certain pages

8 posts

benjohnson#

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#
You can't show a nsDialogs page just by calling a show function. It doesn't work that way.



Stu
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?
Anders#
Originally Posted by benjohnson View Post
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#
Each nsDialog page has a name though, is there any way to jump to those particular pages?
MSG#
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.
benjohnson#
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.