VegetaSan
5th April 2004 23:21 UTC
Background Image ... .OnGUIEnd ...
I want a background in my installer. And it works .. because I tested it. But if I insert it to my "good" script then it will say that Function .onGUIInit allready is used ... but It isnt ... Could somebody help me ?
VegetaSan
5th April 2004 23:54 UTC
I mean ".onGUIInit" sorry :)
insted of .OnGUIEnd in the name of this topic
Vytautas
6th April 2004 00:10 UTC
This usually happens when certain MUI defines are defined in the wrong order. Check the MUI readme for any hints on where the problem might be.
Vytautas
VegetaSan
6th April 2004 09:21 UTC
Ok . Thanks Vytautas
VegetaSan
6th April 2004 10:00 UTC
.. I have checked it .. but I can't see a solution .. please help ... When I use this script .
; script
;..................................
;BACKGROUND-IMAGE-SCRIPT
;.................................
;Languages
; !insertmacro MUI_LANGUAGE "English"
; !insertmacro MUI_LANGUAGE "French"
; !insertmacro MUI_LANGUAGE "German"
; !insertmacro MUI_LANGUAGE "Spanish"
; !insertmacro MUI_LANGUAGE "SimpChinese"
; !insertmacro MUI_LANGUAGE "TradChinese"
; !insertmacro MUI_LANGUAGE "Japanese"
; !insertmacro MUI_LANGUAGE "Korean"
; !insertmacro MUI_LANGUAGE "Italian"
; !insertmacro MUI_LANGUAGE "Dutch"
; !insertmacro MUI_LANGUAGE "Danish"
; !insertmacro MUI_LANGUAGE "Swedish"
; !insertmacro MUI_LANGUAGE "Norwegian"
; !insertmacro MUI_LANGUAGE "Finnish"
; !insertmacro MUI_LANGUAGE "Greek"
; !insertmacro MUI_LANGUAGE "Russian"
; !insertmacro MUI_LANGUAGE "Portuguese"
; !insertmacro MUI_LANGUAGE "PortugueseBR"
; !insertmacro MUI_LANGUAGE "Polish"
; !insertmacro MUI_LANGUAGE "Ukrainian"
; !insertmacro MUI_LANGUAGE "Czech"
; !insertmacro MUI_LANGUAGE "Slovak"
; !insertmacro MUI_LANGUAGE "Croatian"
; !insertmacro MUI_LANGUAGE "Bulgarian"
; !insertmacro MUI_LANGUAGE "Hungarian"
; !insertmacro MUI_LANGUAGE "Thai"
; !insertmacro MUI_LANGUAGE "Romanian"
; !insertmacro MUI_LANGUAGE "Macedonian"
; !insertmacro MUI_LANGUAGE "Estonian"
; !insertmacro MUI_LANGUAGE "Turkish"
; !insertmacro MUI_LANGUAGE "Lithuanian"
; !insertmacro MUI_LANGUAGE "Catalan"
; !insertmacro MUI_LANGUAGE "Slovenian"
; !insertmacro MUI_LANGUAGE "Serbian"
; !insertmacro MUI_LANGUAGE "Arabic"
; !insertmacro MUI_LANGUAGE "Hebrew"
Then It will compile without any errors
but when I delete the ; before the !insertmacros then It will give a error saying
!insertmacro: MUI_LANGUAGE
Error: Function named ".onGUIInit" already exists.
Error in macro MUI_FUNCTION_GUIINIT on macroline 2
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 5
Error in script "C:\Documents and Settings\VegetaS an\Bureaublad\backgroundtest.nsi" on line 172 -- aborting creation process
pengyou
6th April 2004 12:52 UTC
The MUI uses .onGUIInit itself, so your script cannot use .onGUIInit - instead you need to use a MUI define. This is described in the MUI manual:
Customize Modern UI Functions
If you want add your own code to functions inserted by the Modern UI, such as the .onGUIInit function and the Page functions, create your own function and let the Modern UI functions call them. Use the defines to define the name of your functions.
Example:
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
Function myGUIInit
...your own code...
FunctionEnd
General Custom Functions
These defines should be set before inserting the language macros.
MUI_CUSTOMFUNCTION_GUIINIT function
MUI_CUSTOMFUNCTION_UNGUIINIT function
MUI_CUSTOMFUNCTION_ABORT function
MUI_CUSTOMFUNCTION_UNABORT function
VegetaSan
6th April 2004 13:26 UTC
So this would be right ....
!define MUI_CUSTOMFUNCTION_GUIINIT myGUIInit
!define MUI_CUSTOMFUNCTION_UNGUIINIT myGUIInit
!define MUI_CUSTOMFUNCTION_ABORT myGUIInit
!define MUI_CUSTOMFUNCTION_UNABORT myGUIInit
; !insertmacro MUI_LANGUAGE "English"
; !insertmacro MUI_LANGUAGE "French"
; !insertmacro MUI_LANGUAGE "German"
; !insertmacro MUI_LANGUAGE "Spanish"
; !insertmacro MUI_LANGUAGE "SimpChinese"
; !insertmacro MUI_LANGUAGE "TradChinese"
; !insertmacro MUI_LANGUAGE "Japanese"
; !insertmacro MUI_LANGUAGE "Korean"
; !insertmacro MUI_LANGUAGE "Italian"
; !insertmacro MUI_LANGUAGE "Dutch"
; !insertmacro MUI_LANGUAGE "Danish"
; !insertmacro MUI_LANGUAGE "Swedish"
; !insertmacro MUI_LANGUAGE "Norwegian"
; !insertmacro MUI_LANGUAGE "Finnish"
; !insertmacro MUI_LANGUAGE "Greek"
; !insertmacro MUI_LANGUAGE "Russian"
; !insertmacro MUI_LANGUAGE "Portuguese"
; !insertmacro MUI_LANGUAGE "PortugueseBR"
; !insertmacro MUI_LANGUAGE "Polish"
; !insertmacro MUI_LANGUAGE "Ukrainian"
; !insertmacro MUI_LANGUAGE "Czech"
; !insertmacro MUI_LANGUAGE "Slovak"
; !insertmacro MUI_LANGUAGE "Croatian"
; !insertmacro MUI_LANGUAGE "Bulgarian"
; !insertmacro MUI_LANGUAGE "Hungarian"
; !insertmacro MUI_LANGUAGE "Thai"
; !insertmacro MUI_LANGUAGE "Romanian"
; !insertmacro MUI_LANGUAGE "Macedonian"
; !insertmacro MUI_LANGUAGE "Estonian"
; !insertmacro MUI_LANGUAGE "Turkish"
; !insertmacro MUI_LANGUAGE "Lithuanian"
; !insertmacro MUI_LANGUAGE "Catalan"
; !insertmacro MUI_LANGUAGE "Slovenian"
; !insertmacro MUI_LANGUAGE "Serbian"
; !insertmacro MUI_LANGUAGE "Arabic"
; !insertmacro MUI_LANGUAGE "Hebrew"
Function myGUIInit
; THE BACKGROUND
!define DEBUG
!macro GetReturnValue
!ifdef DEBUG
Pop $R9
StrCmp $R9 success +2
DetailPrint "Error: $R9"
!endif
!macroend
InitPluginsDir
# lets extract some bitmaps...
File /oname=$PLUGINSDIR\1.bmp "C:\1.bmp"
;File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
!ifdef DEBUG
# turn return values on if in debug mode
BgImage::SetReturn /NOUNLOAD on
!endif
BgImage::SetBg /NOUNLOAD /GRADIENT 0 0x80 0 0x80 0 0
!insertmacro GetReturnValue
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp 0 0
!insertmacro GetReturnValue
; BgImage::AddImage /NOUNLOAD /TRANSPARENT 255 0 255 $PLUGINSDIR\1.bmp 150 16
!insertmacro GetReturnValue
CreateFont $R0 "Comic Sans MS" 50 700
; BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
!insertmacro GetReturnValue
; BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
!insertmacro GetReturnValue
; BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD
FunctionEnd
It compiles but doesnt work :(
Joost Verburg
6th April 2004 14:29 UTC
Why do you set all custom function to the same GUI initialization functions? You only need GUIINIT and UNGUIINIT.
As you can find in the readme, these defines should be set before inserting the language macros.
Using language macros is required.