Old 29th June 2007, 13:17   #1
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Lightbulb Custom dialogs -- Idea request

Hello!

I don't want to make new thread every day, but I didn't find the answer in forum. Or I searched bad...

Problem is following:
I'd like to have couple of custom pages with 2 edit-boxes. They will appear after installing files. After filling-in the information will appear similar page, but not editable - just for confirmation - and it do some post-install things. Each PAIR of this pages will appear only on user demand. My solution is following:
code:
...
Page Custom Page1PRE Page1LEAVE
Page Custom Page1_ConfirmPRE Page1_ConfirmLEAVE
...
Function Page1PRE
${If} ${Cmd} "MessageBox MB_YESNO|MB_ICONQUESTION 'Page1?' IDYES"
StrCpy $PAGE1 "1"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "Page1.ini"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "Page1.ini"
!insertmacro MUI_INSTALLOPTIONS_SHOW
${Else}
StrCpy $PAGE1 "0"
Abort
${EndIf}
FunctionEnd
...
Function Page1LEAVE
!insertmacro MUI_INSTALLOPTIONS_READ $FIELD1 "Page1.ini" "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $FIELD2 "Page1.ini" "Field 2" "State"
FunctionEnd
...
Function Page1_ConfirmPRE
${If} $PAGE1 == "0" ;
Abort
${EndIf}
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "Page1.ini"
!insertmacro MUI_INSTALLOPTIONS_WRITE "Page1.ini" "Field 1" "Text" $FIELD1
!insertmacro MUI_INSTALLOPTIONS_WRITE "Page1.ini" "Field 2" "State" $FIELD2
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "Page1.ini"
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
...
Function Page1_ConfirmLEAVE
; here I would like to do some work with $FIELD1 and $FIELD2
FunctionEnd
...



Is this a good way? Can I do it better (maybe using sections instead of asking with MessageBox)? Won't this make any problems if user will step back in installer?

Thank you for your opinions! (And sorry for huge post)
pospec is offline   Reply With Quote
Old 29th June 2007, 15:57   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Sure you can. Add some sections and in those sections set the $PAGE1 (and $PAGE2) variables.

Also, you don't need to use INITDIALOG and SHOW. You can just use MUI_INSTALLOPTIONS_DISPLAY.

Stu
Afrow UK is offline   Reply With Quote
Old 29th June 2007, 23:48   #3
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Thx Afrow!

And what about going back in instalator? Can I put that pairs of the pages together in any way? E.g. if I want user to go through one pair of pages and then avoid him to go back. I know the DisableBackButton trick, how to use it on the pairs of pages?
pospec is offline   Reply With Quote
Old 1st July 2007, 14:23   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use the GotoNSISPage function on the Wiki to jump backwards or forwards a number of pages.

Stu
Afrow UK is offline   Reply With Quote
Old 1st July 2007, 19:30   #5
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Thx Afrow! I didn't know about this function... I hope this will help. Then I imply, that using Sections instead of asking messageboxes won't be necessary - am I right?
pospec is offline   Reply With Quote
Old 4th July 2007, 23:30   #6
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
I'd like to ask another question, if I can.

I noticed, that you can't do something like
code:
...
StrCpy $INI_NAME "my-dialog.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT $INI_NAME
...



OK, then I tried
code:
Function Page_Po_Instalaci_pre
StrCpy $DDVERZE "SD"
MessageBox MB_OK "*$DDVERZE*"
!if $DDVERZE == "SD"
MessageBox MB_OK "!!!"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "dlg_Po_Instalaci_SD.ini"
...
!else
MessageBox MB_OK "???"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "dlg_Po_Instalaci.ini"
...
!endif
FunctionEnd


It shows *SD* dialog and then ??? dialog. What is wrong?
pospec is offline   Reply With Quote
Old 5th July 2007, 00:06   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
!if is for compile time. You want ${If}

Stu
Afrow UK is offline   Reply With Quote
Old 5th July 2007, 08:39   #8
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
I know that I can use ${If}. But why doesn't work !if? I thought that it will just ommit lines between !if / !else / !endif. ${If} will pack all these lines (instructions) into installer, won't it?
pospec 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