Archive: Custom dialogs -- Idea request


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:

...
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)

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


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?


Use the GotoNSISPage function on the Wiki to jump backwards or forwards a number of pages.

Stu


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?


I'd like to ask another question, if I can.

I noticed, that you can't do something like

...
StrCpy $INI_NAME "my-dialog.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT $INI_NAME
...


OK, then I tried
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?

!if is for compile time. You want ${If}

Stu


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?