bnicer
25th March 2007, 22:22
NSIS MUI installer wizard images have always had a 164x314 format by default (recommended size).
Is there something evil about a 497x314 welcome/finish page image? I doubt it.
Welcome page screenshot:
http://www.teanow4pm.demon.co.uk/sshots/sshots.png
I posted the same screenshot in this thread (http://forums.winamp.com/showthread.php?s=&threadid=250108&highlight=Background+Image) before. The code example in the other thread puts the image behind the text with two checkboxes on the Finish page.
Finish page screenshot:
http://www.teanow4pm.demon.co.uk/sshots/sshots2.png
The Finish page is more difficult than the Welcome page, because the z-order in ioSpecial.ini already places the bitmap behind the text. Checkboxes should also be on top of the bitmap, so on the Finish page you have to move the image a second time. Initially the title text and the bitmap image are switched around on the Welcome page.
So here's a good question. Someone sent me a private message on the subject today. How do you get the script to point to the bitmap used for the background image? I will try to answer for everyone and be clearer this time. The other thread was vague. That is why I am posting the topic again. Sending PMs is an inconvenient way to obtain simple information.
Step One
Edit System.nsh to reverse the z-order.
First make a backup copy. Then open System.nsh in a text editor and make these changes:
1) Replace every occurrence of "Field 1" with "Field 999".
2) Replace every occurrence of "Field 3" with "Field 1".
3) Replace every occurrence of "Field 999" with "Field 3".
Save the file.
Step Two
Re-define the Welcome page field order in your script.
!define MUI_WELCOMEFINISHPAGE_BITMAP "tigw.bmp" ; equals 497x314 bitmap
; Welcome page
!define MUI_PAGE_CUSTOMFUNCTION_PRE z_order
!define MUI_PAGE_CUSTOMFUNCTION_SHOW font_background
!define MUI_WELCOMEPAGE_TITLE "$(TEXT_WELCOME_INFO_TITLE)"
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "$(TEXT_WELCOME_INFO_TEXT)"
!insertmacro MUI_PAGE_WELCOME
Function z_order
call abort_setup
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Type" Label
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Left" 73
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Top" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Bottom" 185
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Left" 58
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Right" 325
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Top" 15
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Bottom" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Type" Bitmap
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Left" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Right" 331
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Top" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" 193
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Flags" RESIZETOFIT
FunctionEnd
Function font_background
GetDlgItem ${TEMP1} $MUI_HWND 1200
SetCtlColors ${TEMP1} 0x000000 transparent
GetDlgItem ${TEMP1} $MUI_HWND 1201
SetCtlColors ${TEMP1} 0x006699 transparent
CreateFont $R1 "MS Sans Serif" 16 700
SendMessage ${TEMP1} ${WM_SETFONT} $R1 0
FunctionEndStep Three
Change the field order on the Finish page with 2 checkboxes. (This is the same example as in the other thread.)
; Finish page
!define MUI_PAGE_CUSTOMFUNCTION_PRE z_order_finish
!define MUI_PAGE_CUSTOMFUNCTION_SHOW font_background
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE post_install_1
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE "$(TEXT_FINISH_INFO_TITLE)"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "$(TEXT_FINISH_RUN)"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_FUNCTION post_install_2
!insertmacro MUI_PAGE_FINISH
Function z_order_finish
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioSpecial.ini" "Field 3" "Text"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Top" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Bottom" 185
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Top" 15
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Bottom" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Text" "$(TEXT_FINISH_SHOW)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Type" Checkbox
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Left" 78
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Top" 150
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" 160
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "State" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Left" 78
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Top" 130
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Bottom" 140
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Text" $R1
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Type" Bitmap
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Left" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Right" 331
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Top" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Bottom" 193
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Flags" RESIZETOFIT
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "State" ""
FunctionEnd
Function post_install_1
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioSpecial.ini" "Field 3" "State"
StrCmp $R1 "0" done
SetOutPath "$INSTDIR"
ExecShell open "$INSTDIR\$INDEX_H"
done:
FunctionEnd
Function post_install_2
StrCmp $HELP "" rtf html
rtf:
ExecShell open "$INSTDIR\help\readme.rtf"
Goto done
html:
ExecShell open "$INSTDIR\help\tigh.chm"
done:
FunctionEndNote that the Field 3 checkbox State is read in Function post_install_1. Whether you have one or two checkboxes, the Field 4 checkbox interacts with MUI_FINISHPAGE_RUN and MUI_FINISHPAGE_RUN_FUNCTION. MUI_FINISHPAGE_SHOWREADME is needed, as I've discovered, to display the bitmap. (Strange.)
PS: My uninstaller doesn't have a welcome/finish page. If I remember, you don't have to write to ioSpecial.ini to show a 497x314 image there, but I will post code if you do. I hope the examples are enough to go on.
Feel free to comment and ask a question or ten.:)
Is there something evil about a 497x314 welcome/finish page image? I doubt it.
Welcome page screenshot:
http://www.teanow4pm.demon.co.uk/sshots/sshots.png
I posted the same screenshot in this thread (http://forums.winamp.com/showthread.php?s=&threadid=250108&highlight=Background+Image) before. The code example in the other thread puts the image behind the text with two checkboxes on the Finish page.
Finish page screenshot:
http://www.teanow4pm.demon.co.uk/sshots/sshots2.png
The Finish page is more difficult than the Welcome page, because the z-order in ioSpecial.ini already places the bitmap behind the text. Checkboxes should also be on top of the bitmap, so on the Finish page you have to move the image a second time. Initially the title text and the bitmap image are switched around on the Welcome page.
So here's a good question. Someone sent me a private message on the subject today. How do you get the script to point to the bitmap used for the background image? I will try to answer for everyone and be clearer this time. The other thread was vague. That is why I am posting the topic again. Sending PMs is an inconvenient way to obtain simple information.
Step One
Edit System.nsh to reverse the z-order.
First make a backup copy. Then open System.nsh in a text editor and make these changes:
1) Replace every occurrence of "Field 1" with "Field 999".
2) Replace every occurrence of "Field 3" with "Field 1".
3) Replace every occurrence of "Field 999" with "Field 3".
Save the file.
Step Two
Re-define the Welcome page field order in your script.
!define MUI_WELCOMEFINISHPAGE_BITMAP "tigw.bmp" ; equals 497x314 bitmap
; Welcome page
!define MUI_PAGE_CUSTOMFUNCTION_PRE z_order
!define MUI_PAGE_CUSTOMFUNCTION_SHOW font_background
!define MUI_WELCOMEPAGE_TITLE "$(TEXT_WELCOME_INFO_TITLE)"
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "$(TEXT_WELCOME_INFO_TEXT)"
!insertmacro MUI_PAGE_WELCOME
Function z_order
call abort_setup
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Type" Label
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Left" 73
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Top" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Bottom" 185
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Left" 58
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Right" 325
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Top" 15
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Bottom" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Type" Bitmap
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Left" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Right" 331
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Top" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" 193
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Flags" RESIZETOFIT
FunctionEnd
Function font_background
GetDlgItem ${TEMP1} $MUI_HWND 1200
SetCtlColors ${TEMP1} 0x000000 transparent
GetDlgItem ${TEMP1} $MUI_HWND 1201
SetCtlColors ${TEMP1} 0x006699 transparent
CreateFont $R1 "MS Sans Serif" 16 700
SendMessage ${TEMP1} ${WM_SETFONT} $R1 0
FunctionEndStep Three
Change the field order on the Finish page with 2 checkboxes. (This is the same example as in the other thread.)
; Finish page
!define MUI_PAGE_CUSTOMFUNCTION_PRE z_order_finish
!define MUI_PAGE_CUSTOMFUNCTION_SHOW font_background
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE post_install_1
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE "$(TEXT_FINISH_INFO_TITLE)"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "$(TEXT_FINISH_RUN)"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_FUNCTION post_install_2
!insertmacro MUI_PAGE_FINISH
Function z_order_finish
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioSpecial.ini" "Field 3" "Text"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Top" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Bottom" 185
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Top" 15
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Bottom" 80
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Text" "$(TEXT_FINISH_SHOW)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Type" Checkbox
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Left" 78
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Top" 150
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" 160
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "State" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Left" 78
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Right" 258
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Top" 130
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Bottom" 140
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Text" $R1
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Type" Bitmap
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Left" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Right" 331
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Top" 0
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Bottom" 193
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "Flags" RESIZETOFIT
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 5" "State" ""
FunctionEnd
Function post_install_1
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioSpecial.ini" "Field 3" "State"
StrCmp $R1 "0" done
SetOutPath "$INSTDIR"
ExecShell open "$INSTDIR\$INDEX_H"
done:
FunctionEnd
Function post_install_2
StrCmp $HELP "" rtf html
rtf:
ExecShell open "$INSTDIR\help\readme.rtf"
Goto done
html:
ExecShell open "$INSTDIR\help\tigh.chm"
done:
FunctionEndNote that the Field 3 checkbox State is read in Function post_install_1. Whether you have one or two checkboxes, the Field 4 checkbox interacts with MUI_FINISHPAGE_RUN and MUI_FINISHPAGE_RUN_FUNCTION. MUI_FINISHPAGE_SHOWREADME is needed, as I've discovered, to display the bitmap. (Strange.)
PS: My uninstaller doesn't have a welcome/finish page. If I remember, you don't have to write to ioSpecial.ini to show a 497x314 image there, but I will post code if you do. I hope the examples are enough to go on.
Feel free to comment and ask a question or ten.:)