Old 28th January 2016, 00:53   #1
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
Summary screen passing variables

Hi All,

I am working on a summary page for my installer. I created the dialog using the cool soft designer and included the code in my installer as a SummaryPage.nsh file. I usually separate out custom UI to make the main nsi file look cleaner. I also put any other custom functions also into .nsh files and include them in my main nsi.

So, in one of my custom dialogs I have a couple ports that the user enters and am trying to show that in the summary page as a label. In my custom page where the ports are declared I have the following code, during pageleave I have the following set:

${NSD_GetText} $hCtl_FoundationDialog_TextBox1 $HTTPPortNumber
${NSD_GetText} $hCtl_FoundationDialog_TextBox2 $HTTPSPortNumber

How can I use this $HTTPPortNumber and $HTTPSPortNumber in my Summary dialog?
If I include the whole Summary Dialog in my nsi file it works fine, something like this:

${NSD_CreateLabel} 136.91u 69.54u 84.91u 14.15u "$HTTPSPortNumber"
Pop $hCtl_SummaryDialog_Label8

${NSD_CreateLabel} 136.91u 55.38u 84.91u 14.15u "$HTTPPortNumber"
Pop $hCtl_SummaryDialog_Label7

I see that there is no option in a .nsh file to do an include like we do in the .nsi files.

Any suggestions will be appreciated.

--Pavan
pkonduru is offline   Reply With Quote
Old 28th January 2016, 12:12   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
There is no real difference between nsi and nsh files, the compiler does not care.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th January 2016, 16:31   #3
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
Anders,

!include abc.nsh does not working inside an nsh file. The error says "could not find abc.nsh" even though it's there in the same directory.
pkonduru is offline   Reply With Quote
Old 28th January 2016, 17:11   #4
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
I also checked that variables declared out of functions and sections are by default global. The variables that I wanted in the summary page are declared in my .nsi outside of the sections and functions. WHen I use these variables in my .nsh file. i notice that after compilation , there are warnings saying "unlnown variable/constant $HTTPPort detected. ignoring(include\SummaryPage.nsh)
pkonduru is offline   Reply With Quote
Old 28th January 2016, 17:17   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Declare the variable before including the nsh.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th January 2016, 17:23   #6
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
Awesome Anders!! that worked. Thanks a ton!
pkonduru is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump