![]() |
#1 |
Junior Member
Join Date: Jan 2011
Posts: 4
|
nsDialog page re-use
Hi,
I am wondering the best way to achieve this... I have to collect data from the installer multiple times based on a user input integer. As far as I am aware I can't add pages in dynamically I have to add a bunch in and then skip them (please correct me if I am wrong ![]() I know I can add the same page multiple times by simply calling code: multiple times. The problem arises when I need to collect the data from the page to process it on installation. Is there a simple way to customise the variable names to make them unique without defining the pages multiple times? All help appreciated! Cheers |
![]() |
![]() |
![]() |
#2 |
Major Dude
|
I am not sure whether you mean this, but you can have a try:
You can define a symbol with some "prefix" or string in it like here: code: where code: So you can call functions like this: code: code: Hope it helps... I found this in MUI2.nsh related files, maybe you could check them. Cool looking installers with custom design: www.graphical-installer.com Create Setup Pages easily: www.install-designer.com Build installers in Visual Studio 2005-2022: www.visual-installer.com or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Aug 2010
Posts: 29
|
As you probably know, Variables in NSIS are global no matter where they are declared (top of file, function, or section. See: http://nsis.sourceforge.net/Docs/Chapter4.html#4.2). If you declare them in a function, you have to place /GLOBAL in front of it to indicate this. When you declare a custom page to use:
page custom MyPage MyPageLeave ;where MyPage is the function to define the page and MyPageLeave is called when the page is left. Then you would have two fxns somewhere in your nsi file: Function MyPage Var /GLOBAL someVar ;some code to define and display your page FunctionEnd Function MyPageLeave ;maybe manipulate the user provided integer here. FunctionEnd It is possible that if you manipulate the user provided integer right away, you could do so in the MyPageLeave function and only ever need one variable for this integer. However, if you obtain a series of integers before you do anything with them, then you likely need to create separate variables for however many instances you will need. So if you will display the page five times and require five inputs, declare five variables (kind of ugly, I know and someone may have a better suggestion). Also, I suggest you consider using an array for this if it fits what you are trying to do because it could be cleaner. Hope this helps. |
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Jan 2011
Posts: 4
|
Thank you.
I have located the Array plugin (NSISArray) which is working well. I have created a function for each page and another for the page leave. Inside the functions I am calling a macro with a unique id from the calling page (function). All the UI widgets for the common pages are created in the macro (which makes the code cleaner) and the unique id is used to index the data in the array. I am also using the integer passed in from the user to let the page decide if it should show its self (Abort) or not which makes the pages (appear to) show dynamically. |
![]() |
![]() |
![]() |
|
Tags |
dynamic, nsdialogs, pages |
Thread Tools | Search this Thread |
Display Modes | |
|
|