Archive: Custom Page question


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


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


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.


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


As you can probably tell, I'm new at NSIS. Thanks again.


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


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.


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.