aeshkar
15th October 2003 14:48 UTC
Custom Page question
Hi,
I'm trying to skip showing a custom page if a certain file exists. I'm using the following code:
!define MUI_PAGE_CUSTOMFUNCTION_PRE "UserIDandPWPre"
Page custom UserIDandPW
Funtion UserIDandPWPre
IfFileExists "somepath\somefile.txt" skipPage showPage
skipPage:
Abort
showPage:
FunctionEnd
I expected the UserIDandPWPre function to run before the page is shown
and skip it if the file exists. Instead it shows the page, and only executes on the next button click. In other words, it behaves like a
MUI_PAGE_CUSTOMFUNCTION_LEAVE function. I verified this with a MessageBox in the function.
Any ideas?
Thanks
Afrow UK
15th October 2003 16:17 UTC
I don't think MUI can support a PRE function for custom pages, because you can't actually have PRE functions for custom pages without MUI already.
You should do this instead:
; Custom page function
Funtion UserIDandPW
IfFileExists "somepath\somefile.txt" 0 skippage
InstallOptions::Dialog "myfile.ini"
skippage:
FunctionEnd
-Stu
aeshkar
15th October 2003 16:56 UTC
That worked. Thanks. Someone should document the fact that Custom Pages cannot have PRE,SHOW and LEAVE functions. Its not clear at all, unless I missed something. It would be a nice feature to add to be consistant with the other pages.
Afrow UK
15th October 2003 17:24 UTC
You simply need to look at the Page command;
These are the syntaxes:
Page custom <show_function> <leave_function> <title>
Page <other> <pre_function> <show_function> <leave_function>
-Stu
aeshkar
15th October 2003 17:44 UTC
As you can probably tell, I'm new at NSIS. Thanks again.
Afrow UK
16th October 2003 18:36 UTC
You are right however, if there is no mension of the fact that Custom pages do not have a PRE function in the documentation, then one could/should be added.
-Stu
Joost Verburg
16th October 2003 18:44 UTC
The documentation is right:
custom [creator_function] [leave_function] [caption]
OR
(license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function]
Normal pages have a pre/show/leave function. Custom pages have a creator/leave function.
deguix
16th October 2003 20:51 UTC
But the PRE function is before using the Install Options Plugin.
You can do about the same thing as the normal PRE function pages using "Call PREFunction" (PREFunction is the PRE Function Name) before using Install Options Plugin in your custom page function.