- NSIS Discussion
- MUI and .onGUIEnd
Archive: MUI and .onGUIEnd
ddod
20th July 2005 19:32 UTC
MUI and .onGUIEnd
It would seem that if I use the MUI I cannot add to the .onGUIEnd callback. Is this true? I tried to create my own and was told that it was already defined. I assume this is becasue MUI needs to do quite a bit of clean up using this callback.
However, I have some cleanup of my own that needs to be run regardless of what happens during the install (success, failure, cancel, etc.)
Is there another way to do this or do I have to define my cleanup commands in multiple locations to cover myself?
Thanks again.
scully13
20th July 2005 19:42 UTC
Are you possibly running your installer silently? If so those GUI callback functions won't be called.
ddod
20th July 2005 19:53 UTC
No it is a full graphical install. I am sure that the .onGUIEnd is being run by the MUI, I just don't seem to have access to add my own code to that particular function.
Dead_Overlord
21st July 2005 06:02 UTC
I have the same question!
I have this same question!
For the ".onGUIInit" callback function i use the command:
!define MUI_CUSTOMFUNCTION_GUIINIT myguinitfunction
But for the ".onGUIEnd" callback function i have no idea about how to add my own commands.
Joost Verburg
21st July 2005 16:47 UTC
The MUI does not set the .onGUIEnd function. It must be another library.
ddod
21st July 2005 19:04 UTC
I am not loading any other libraries. But I am still getting hte error when I try to create the .onGUIEnd function that it is already defined. MUI.nsh is the only thing I am loading.
Joost Verburg
21st July 2005 20:01 UTC
Can you attach a minimal example that reproduces the problem?
ddod
21st July 2005 21:18 UTC
Well I tried to create a simple script that caused the problem but couldn't. SO I moved the .onGUIEnd function to the start of my script to see where the error would happen. As I thought my function was defined first so I got an error when it tried to load it again. Here is the error I got.
Error: Function named ".onGUIEnd" already exists.
Error in macro MUI_FUNCTION_GUIINIT on macroline 20
Error in macro MUI_INSERT on macroline 11
Error in macro MUI_LANGUAGEFILE_BEGIN on macroline 4
!include: error in script: "C:\Program Files\NSIS\Contrib\Modern UI\Language files\English.nsh" on line 9
Error in macro MUI_LANGUAGE on macroline 9
So it is trying to define it again in the MUI when I run the following command
!insertmacro MUI_LANGUAGE "English"
Is there a way around this?
ddod
21st July 2005 21:27 UTC
Well I just noticed that it is the UltraModernUI that is causing the problems. I just switched it back to the MUI instead od UMUI and it works great.
So the next question is, since it looks like the UMUI is already implenting the .onGUIEnd function, is there any way to add my own code to his? (Unless anyone else has any suggestions for a place to run my cleanup code)
Dead_Overlord
22nd July 2005 05:51 UTC
I have your answer!
To resolve it is simple!
See the code in the file "UMUI.nsh" (use the Search or Find tool of your editor).
Find the function ".onGUIInit", you see the following code:
!ifdef MUI_CUSTOMFUNCTION_GUIINIT
Call "${MUI_CUSTOMFUNCTION_GUIINIT}"
!endif
It accept the comand for a custom .onGUIInit function:
!define MUI_CUSTOMFUNCTION_GUIINIT myguiinit
To create the command that point to your own code you need to write the file "UMUI.nsh". Add the following lines inside the ".onGUIEnd" function that was already defined inside this file:
!ifdef MUI_CUSTOMFUNCTION_GUIEND
Call "${MUI_CUSTOMFUNCTION_GUIEND}"
!endif
Inside the script that you want to use a custom .onGUIEnd, insert the following line:
!define MUI_CUSTOMFUNCTION_GUIEND myguiend
And create the function:
Function myguiend
...my own code...
functionend
ddod
22nd July 2005 15:25 UTC
Thanks for th input. I made the changes and everything compiled just fine. However the function never seems to run. MUI does not have a MUI_CUSTOMFUNCTION_GUIEND built into their program, could that be the problem?
I get the following warning:
install function "myguiend" not referenced - zeroing code (286-288) out
nsnb
7th August 2008 00:13 UTC
Originally posted by ddod
I get the following warning:
install function "myguiend" not referenced - zeroing code (286-288) out
I am having the same exact problem with myGuiInit, which doesn't seem to be invoked at all (although the script compiles OK).
I followed the instruction in C:\Program Files\NSIS\Docs\Modern UI 2\Readme.html:
Interface functions provided by NSIS, like the .onGUIInit function and the page functions are automatically included by the Modern UI and filled with code to support new interface features. If you want to add additional code to these function, create a function with the custom script code in the script use the Modern UI functions call them.
Example:
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
Function myGUIInit
...
FunctionEnd
What am I doing wrong?
Is the location of !define MUI_CUSTOMFUNCTION_GUIINIT important?
typhoon_bg
25th August 2009 18:22 UTC
Yes, define it before
!include "MUI.nsh"
I had the same problem and it is now fixed.
Cheers,
Georgi