Skip to content
⌘ NSIS Forum Archive

nsDialogs::Show does not show controls on 2nd custom page

9 posts

gheilig#

nsDialogs::Show does not show controls on 2nd custom page

When I try to display two consecutive custom nsDialog pages, the first nsDialog page's controls are displayed correctly while the second page's controls are remain invisible (or hidden):


; Allows for the creation of Dialog Box controls within "Create"d dialog boxes.
!include nsDialogs.nsh

; Include the Logic Library for high level macros
!include LogicLib.nsh

...

;-------------------------------------------------------------------

Page custom ChoosePasswordPgFunc


Function ChoosePasswordPgFunc

nsDialogs::Create RESOURCE_ID_OF_RECT_STRUCT
Pop $ChoosePwdDialog
${If} $ChoosePwdDialog == error
!insertmacro _LogWrite 'Error while creating the password dialog box!'
Abort
${EndIf}

${NSD_CreateLabel} 40 0u 90% 30u "A password is recommended if you wish to prevent some Hub users from accepting unsoliticed client application connection requests, edit the Hub's system map, or exit the Hub application."
Pop $ChoosePwdDialogLabel
${If} $ChoosePwdDialogLabel == error
!insertmacro _LogWrite 'Error while creating a label 1 for the password dialog box!'
Abort
${EndIf}

nsDialogs::Show

FunctionEnd


Page custom ChooseCentralPgFunc


Function ChooseCentralPgFunc

nsDialogs::Create RESOURCE_ID_OF_RECT_STRUCT
Pop $ChooseCentralDialog
${If} $ChooseCentralDialog == error
!insertmacro _LogWrite 'Error while creating the Central dialog box!'
Abort
${EndIf}

${NSD_CreateLabel} 40 0u 90% 30u "CENTRAL."
Pop $ChooseCentralDialogLabel
${If} $ChooseCentralDialogLabel == error
!insertmacro _LogWrite 'Error while creating a label 1 for the Central dialog box!'
Abort
${EndIf}

nsDialogs::Show

FunctionEnd
All I want to do is show two consecutive custom pages with each with a single label control that I have created.
Instead, with the above code, the first page shows its label, then I press the "Next" button to go to the second custom page, but the second custom page's controls are not displayed.
All the other standard NSIS buttons above and below my controls are correctly displayed (the usual "Prev" & "Install" buttons at the bottom of the window, etc.).

This strange behavior goes away when I insert a standard page in between my two custom pages like this:



Page custom ChoosePasswordPgFunc

...

Page license

Page custom ChooseCentralPgFunc

...

In this case my second custom ChooseCentralPgFunc page shows all of its controls perfectly.

Obviously the "Page license" is resetting or reinitializing something within the nsDialogs library. I would like to know what I can do to make my second custom page show up without inserting any additional code.

I have searched exhaustively for the answer to my program already in this forum and elsewhere and I have not found any answers to this problem.

Any help would be greatly appreciated.

Thank you in advance!
aerDNA#
Your code works perfectly fine for me, with nsDialogs::Create 1018, of course. Why did you post "nsDialogs::Create RESOURCE_ID_OF_RECT_STRUCT", what value are you using?
gheilig#
Thank you for your quick response.

Yes, I forgot to include the !define (including my own code comments) which includes the value you correctly guessed "1018":

; 1018 is the value of the identifier within the nsDialogs Plug-in whose location and size
; that will be used to size create dialogs made within this script. The location and size
; come from a rectangle structure within the nsDialogs Plug-in.
!define RESOURCE_ID_OF_RECT_STRUCT 1018

I suppose it could be something else that I am doing wrong, but I have read the NSIS and nsDialogs documentation and I cannot see what it might be.

I think I will cut my code down to a bare minimum and see if there is anything else I might be doing wrong.

Do you have any suggestions as what might be going on? Otherwise I will build a bare bones project to see if I can figure out what is going on.

Again, thanks for the quick response!
aerDNA#
Then it should be nsDialogs::Create ${RESOURCE_ID_OF_RECT_STRUCT}, which I assume it is because otherwise you wouldn't get anything on either page. Your problem could be a number of things, it's difficult to guess without seeing the full code you're actually using.
gheilig#
Yes, you are the best! That's what it was! All is now well.
Dumb beginner's mistake on my part.
I becoming a big fan of NSIS.

Thanks one more time for your quick response!
Anders#
I don't know where you got that name from but IMHO RESOURCE_ID_OF_INNERDIALOG_CONTAINER is more descriptive if you insist on having a define. (It is technically not a container in the current implementation but it fits better mentally)
gheilig#
I just made that up to describe what that constant does instead of just leaving it a "magic number" of 1018.
But your constant name is better than mine. I will use it.

Thanks for all your help!
aerDNA#
Rect_ID if you ask me. Simple, short and says everything (well, says enough). Your original name was a poor choice because RECT struct is really something else.
aerDNA#
...note that underscore is essential because RectID sounds like a colon-cleansing nanobot, or a controversial new method of collecting biometric data for passports.