- NSIS Discussion
- Showing a custom page if...
Archive: Showing a custom page if...
Afrow UK
8th March 2003 11:23 UTC
Showing a custom page if...
IfFileExists "$TEMP\map-compiler.ini" WriteSettingsNo
WriteINIStr "$TEMP\map-compiler.ini" "Settings" "Show" "Yes"
WriteSettingsNo:
ReadINIStr $1 "$TEMP\map-compiler.ini" "Settings" "Show"
StrCmp $1 Yes ViewSettingsYes ViewSettingsNo
ViewSettingsYes:
Page Custom SetCustom2 " - Change required settings"
ViewSettingsNo:
ReadINIstr $2 "$TEMP\map-compiler_settings.ini" "Field 6" "State"
StrCmp $2 1 DialogYes DialogNo
DialogYes:
Page Custom SetCustom2 " - Change required settings"
DialogNo:
I have tried puttin this code everywhere, but it won't work.
I'd like the custom page to show before the MUI Welcome page only if the user has aloowed it before.
On first load of the program, the user will be allowed to toggle 'Show settings dialog'. If it is off (0) then it won't be shown again.
Why isn't the custom page showing?
-Stuart
kichik
8th March 2003 11:28 UTC
Page is not a runtime command. The fact that it can be used in sections and functions has been fixed in the latest CVS version. You'll need to condition the call to InstsallOptions, because you can't condition Page.
For example:
ShowPage
StrCmp$1 No skip
InstallOptions
::dialog $TEMPdialog.ini
Pop$2
skip:
>FunctionEnd
>
Afrow UK
8th March 2003 13:00 UTC
I see.
I'd have the function and now have...
ReadINIStr $1 "$TEMP\map-compiler.ini" "Settings" "Show"
StrCmp $1 Yes ViewSettingsYes ViewSettingsNo
ViewSettingsYes:
Call ShowPage
ViewSettingsNo:
Yeah?
-Stuart
Afrow UK
8th March 2003 14:39 UTC
I don't know where to put this piece of code. It needs to go in a function, but the only function before the welcome page is ${PRE}
Putting it in there works, but it really doesn't work good.
Clicking next goes to the welcome page, but the back button doesn't appear.
Also, clicking next once brings up the custom IO page again.
I think I will have to do this..
Function .onInit
WriteINIStr "$TEMP\map-compiler_settings_show.ini" " " " " " "
FunctionEnd
Function ShowPage
IfFileExists "$TEMP\map-comiler_settings_show.ini" 0 +2
InstallOptions::dialog "$TEMP\map-compiler_settings.ini"
FunctionEnd
Function .onInstSuccess
Delete "$TEMP\map-compiler_settings_show.ini"
FunctionEnd
-Stuart
Afrow UK
8th March 2003 14:47 UTC
Ok, well the Next and Back buttons still screwed...
Custom Page
Next >
Welcome Page
Next >
No < Back button
InstFiles Page
< Back, Next>
< Back goes to Custom Page not Welcome Page
-Stuart
Afrow UK
8th March 2003 14:56 UTC
Never mind. I have changed it to a perminant page, since once the page was turned off, the user couldn't turn it back on.
It doesn't matter too much that the user has to go through one more page really!
-Stuart
deguix
8th March 2003 18:42 UTC
If you use Modern UI, and custom pages, you have to use:
!define MUI_PAGECOMMAND_[PAGE_NAME]
In your case, you used the:
!define MUI_WELCOMEPAGE
So, you should use:
!define MUI_PAGECOMMANDS_WELCOME
Afrow UK
8th March 2003 19:22 UTC
That would remove the welcome page and replace it with my custom page would it not?
-Stuart
deguix
8th March 2003 19:27 UTC
Only replace the !define MUI_WELCOMEPAGE by !define MUI_PAGECOMMANDS_WELCOME. Nothing else. This will should help you.
[edit]Whoops, is MUI_PAGECOMMAND_WELCOME, sorry![/edit]
Joost Verburg
9th March 2003 00:36 UTC
You need both !define MUI_WELCOMEPAGE and !insertmaco MUI_PAGECOMMAND_WELCOME. Insert the macro on the right place between the other page commands.