Archive: Questions on InstallOptions


Questions on InstallOptions
This is part of my script

Function selectaction
selectactionstart:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "menu01.ini"

!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "menu01.ini" "Field 1" "State"
StrCmp ${TEMP1} "1" selectactionend ""
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "menu01.ini" "Field 2" "State"
StrCmp ${TEMP1} "1" selectactionend ""

MessageBox MB_ICONINFORMATION|MB_OK "You have to choose on action, otherwise 'cancel'"
Goto selectactionstart

selectactionend:
FunctionEnd


RadioOptions:
Field 1 is "Save"
Field 2 is "Restore"
(default is "Save")

If both are stated=0 (a message box normally appears) and i press "cancel" i get the cancel dialog but then i get the message box.
How can i determine that the cancel button was pressed and quit the installer/program?

There's another question:
If both are stated=0 (a message box normally appears) and i press "cancel" i get the cancel dialog (confirming YES), then the message box - then program ends up with no final page..


page custom selectaction
page custom selectsaveitems
page custom selectrestoreitems
!insertmacro MUI_PAGE_FINISH

Function selectsaveitems
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "menu01.ini" "Field 1" "State"
StrCmp ${TEMP1} "1" "" selectsaveitemsskip
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "savemail.ini"
selectsaveitemsskip:
FunctionEnd

Function selectrestoreitems
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "menu01.ini" "Field 2" "State"
StrCmp ${TEMP1} "1" "" selectrestoreitemsskip
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "restmail.ini"
selectrestoreitemsskip:
FunctionEnd

If the user clicks cancel it cancels the whole installer not only the current page and therefore the finish page is not shown.

If you want to disable the confirmation message when the user clicks cancel remove this line: "!define MUI_ABORTWARNING".

Vytautas


If you're using a CVS version and not b3 then it would be a better idea to put the checking code in the leave function of the page. This way it will only check when the user tries to move to the next page.

If you're using b3 then you should check for IO's return value. Use the MUI_INSTALLOPTIONS_DISPLAY_RETURN macro and pop the result. If it's "success" then the user is trying to move on to the next page and you should check the input.


@kichik - i use the latest cvs.

@Vytautas


the 1st problem ist to get the state of the cancel button although it is not defined in the IO

the 2nd problem is that in case of the cancel button the cancel dialog appears (confirmed yes) and then the message box (which has not to appear).
Then when i choose "save" (or "restore") and press "next" the program quits without any further page (or comment).


BTW is it possible to call these pages as a function? And if not why not and how then?

page custom selectaction
page custom selectsaveitems
page custom selectrestoreitems


Function code pls see 1st posting.

Cause: it is recommended to recourse those pages if the end has been reached.

##edit again
it is possible to transfer some vars to the IO?
I need to display the $INSTDIR here:
[Field 7]
Type=DirRequest
Left=10
Right=300
Top=95
Bottom=108
State=

back to my last question

is this somehow possible?

[Field 7]
Type=DirRequest
Left=10
Right=300
Top=95
Bottom=108
State=$INSTDIR


"State=" has to be a directory which is read out somewhere before as default.

To change the INI file on runtime use the MUI_INSTALLOPTIONS_WRITE macro.

If you'll use the leave function you won't need to worry what the user clicked on. The check will only be done when the user clicks next and when he clicks cancel it will not show both message boxes.

What do you mean by calling the pages as a function? Recoursing them? Do you want to show them again? If so you'll have to insert more page commands. Calling the creator function yourself will not work as expected.