Skip to content
⌘ NSIS Forum Archive

Background image

11 posts

bnicer#

Background image

I know how to re-compile 'modern_headerbmp.exe' in Resource Hacker, so the header bitmap image is in the background and the text is on top. I was wondering if you could do the same thing with the welcome & finish page bitmap. Editing the fields in ioSpecial.ini always puts the image on top of the text. It occurs to me that you might be able to swop fields 1 and 3, but would that work, and where would you modify the settings? The bitmap is field 1; field 2 and field 3 are the welcome & finish text.
kichik#
Swapping the fields would work because their order in the INI file sets Z order. You could modify ioSpecial.ini using MUI_INSTALLOPTIONS_READ and MUI_INSTALLOPTIONS_WRITE in functions defined by MUI_PAGE_CUSTOMFUNCTION_PRE. As the MUI readme says:
In the Pre function of the Welcome page and the Finish page, you can write to the InstallOptions INI file of the page (ioSpecial.ini)
bnicer#
Changing the z-order works, but you pay a price. The image is gone when you go Back from the next window. And the text assumes a gray background color.

How can I restore the background to white and keep the image from disappearing? Is it possible to do both?
bnicer#
I ran a search & replace in notepad to substitute Field 1 with Field 3 and Field 3 with Field 1. Then I renamed the fields in 'ioSpecial.ini'. Now the bitmap image is in the background and it doesn't disappear when you go Back from the next window.

And you can do this:


!define MUI_PAGE_CUSTOMFUNCTION_SHOW font_background
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "$(TEXT_WELCOME_INFO)"
!insertmacro MUI_PAGE_WELCOME

Function font_background
GetDlgItem $R0 $MUI_HWND 1200
SetCtlColors $R0 0x000000 0xFFFFFF
FunctionEnd
1200 is Field 1.
0xFFFFFF makes the background white.

Is there is any reason I shouldn't modify 'System.nsh'?
Afrow UK#
It's not really wise as the same changes will be applied to all installers you create. Also when you install a new version of NSIS your changes will be lost.

-Stu
bnicer#
There is now a better way of changing the 'ioSpecial.ini' field order using MUI_INSTALLOPTIONS_WRITE. The image is visible when you go Back from the next page. To whoever fixed it in NSIS 2.18, thank you. Bad timing on my part.🙂
bnicer#edited
The Welcome/Finish pages display a 497 x 314 image in the background.

I got a PM in January asking me how I fixed the image disappearing when pressing back.

=====================

I didn't check my messages until last week.

=====================

I'm fairly sure it was nothing I did. The issue fixed itself in NSIS 2.18.

Maybe the problem was/is:

To send the bitmap to the back behind the text, the z-order is reversed. You can do that in ioSpecial.ini. The recommended way is with MUI_INSTALLOPTIONS_WRITE. I think I tried (and possibly may have succeeded) only using MUI_INSTALLOPTIONS_WRITE ... Later I returned to editing System.nsh, which I started out attempting, because it was less complicated.

The changes are risky.

Afrow UK wrote:

It's not really wise as the same changes will be applied to all installers you create. Also when you install a new version of NSIS your changes will be lost.
If anyone would like to try, I could paste the modified System.nsh code below. It's a long file. NSIS Modern User Interface version 1.75 written by Joost Verburg. 2000+ lines. About 20 characters are changed.

I would suggest just posting the differences, but they're all over the place.
bnicer#edited
System.nsh is the same in NSIS 2.24, 2.23, 2.22 and 2.21. The modified file is for those versions.

The link might be obsolete before long. Sorry about that.

Edit System.nsh yourself by first making 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.

Images:
Design a 497x314 image with enough area to display text. An orange title won't be visible on an orange background. The Welcome page and Finish page do not have the same text and other languages do not use the same text strings; please bear that in mind.

How to show two checkboxes on the Finish page:
You can customize the following code.

!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
The bitmap is Field 3 before and Field 5 afterwards.