Old 22nd May 2014, 14:41   #1
grs1961
Junior Member
 
Join Date: Apr 2009
Posts: 8
Unknown number of pages at run time...

I have a requirement to configure an unknown number of (call them) customers at install time.

It could be as few as one, it could be as may as a couple of dozen.

The customer names are hashed, and, of course, no collisions can be allowed, so it cannot be simple list, each name has to checked on entry and validated.

I have come up with a brute-force approach, involving a "finish" check box, and "delete/un-delete" radio buttons, storing data in a bunch of arrays, and a quick bit of python to spit out a hundred page functions and invocations, but it's fiddly, and I don't trust it.

It's been a while since I've worked with NSIS, is there something I have missed that I can use here?

Just to reiterate it is at RUN TIME I have to handle multiple entries, not build time.

Thoughts? Comments? Ideas?
grs1961 is offline   Reply With Quote
Old 22nd May 2014, 15:07   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,172
Unlimited number of custom pages in a row is possible, if you need other pages you might have to try the jump to/skip a page code on the wiki...

Quote:
Page Custom customCreate customLeave
Page InstFiles

!include nsDialogs.nsh
!include LogicLib.nsh
var custOk
Function customCreate
again:
StrCpy $custOk 0
nsDialogs::Create 1018
System::Call kernel32::GetTickCount()i.r0
${NSD_CreateLabel} 0 0 100% 24u "Customer $0"
GetDlgItem $0 $hwndparent 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
nsDialogs::Show
${If} $custOk <> 0
MessageBox MB_YesNo Again? IDYES again
${EndIf}
FunctionEnd

Function customLeave
StrCpy $custOk 1
FunctionEnd

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th May 2014, 14:05   #3
grs1961
Junior Member
 
Join Date: Apr 2009
Posts: 8
Oh, of course, so obvious once you see it!

Or, did I ever really know that the "leave" function is (effectively) called by "nsDialogs::Show", as opposed to being an attribute of the entire "page'd" function?

I don't suppose there is any way to determine if Prev or Next have been clicked?
grs1961 is offline   Reply With Quote
Old 27th May 2014, 15:32   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,172
The leave callback is only called when you click next.

IntOp $PostCount $PostCount + 1
Anders 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