- NSIS Discussion
- 497x314 Wizard Images
Archive: 497x314 Wizard Images
bnicer
25th March 2007 23:22 UTC
497x314 Wizard Images
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 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
FunctionEnd
Step 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:
FunctionEnd
Note 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.:)
TYT
26th March 2007 12:23 UTC
I'm getting an error with this part of the script;
GetDlgItem ${TEMP1} $MUI_HWND 1200
All it tells me is "error in script, aborting process".
BTW, thank you for posting this, if I can get it to work it'll be sweet.
bnicer
26th March 2007 13:15 UTC
Maybe the temp variable is missing:
!define TEMP1 $R0
?
TYT
26th March 2007 13:49 UTC
Aye, went searching thru the forums and found that just replacing ${temp1} with $R0 seems to do the trick ( i think ).
Also, I had to change the $(TEXT_WELCOME_INFO_TITLE) along with the other two similar statements to $(MUI_TEXT_WELCOME_INFO_TITLE) for my text to show up.
Just about got it working! :D
demiller9
26th March 2007 14:28 UTC
${} indicates a constant (defined value). To get a dialog handle you must use a VARiable, which is written with the $ only. bnicer's suggestion would work because the preprocessor will replace the define ${TEMP1} with the var $R0.
Don
bnicer
26th March 2007 16:13 UTC
Also, I had to change the $(TEXT_WELCOME_INFO_TITLE) along with the other two similar statements to $(MUI_TEXT_WELCOME_INFO_TITLE) for my text to show up.
Another option is to use your own language strings (which is what I did). In a personalized string you can insert line breaks.
LangString TEXT_WELCOME_INFO_TITLE ${LANG_ENGLISH} "Welcome to the\r\n$(^NameDA)\r\nSetup Wizard"
LangString TEXT_WELCOME_INFO_TITLE ${LANG_GERMAN} "Willkommen zum\r\n$(^NameDA)\r\nSetup-Assistenten"
Tweaking the right margin in ioSpecial.ini to approximate where line breaks should occur in the title may have unexpected results, if the title in another language happens to be a longer string...
- Tom
TYT
13th May 2007 18:19 UTC
Well, i've gotten better at understanding the terminology in NSIS and deciphering the strings and such in the scripts.
My main problem now is that the checkboxes on the finish page are not transparent. I've got an image for the background that is dual color ( white with an image offset to the left ) and the checkbox background is solid white, cutting into the offset image. I've searched the forums and discovered that checkbox transparencies are somewhat of a problem with NSIS and i've tried everything from getting the HWND of the checkbox and setting that to transparent, to using the /BRANDING setting. ( the latter places a gray background behind text, and a solid white background in the space defined for the checkbox label in the .ini file. )
I've set my script up to almost exactly mimic the one posted here, aside from changing some relevant settings like defined labels instead of strings, ( i.e. using the default welcome info instead of $(text welcome info)) the new background image and only having one readme file to choose from ( simple txt file, not either .rtf or HTML )
I can attach the script if necessary, but there's hardly any change in the finish page settings that are not posted above, yet my checkboxes are simply not showing the background image behind them. As a workaround, i've shifted the checkboxes to the right a bit so they are not over the background part that has the two colors, only over the white and it's working atm but i'd like to have everything line up on the finish page.
Any ideas? ThanQ for taking the time.
bnicer
14th May 2007 08:27 UTC
This thread describes a workaround. You create checkboxes without text and then add label fields for the text next to the checkboxes. Background can be transparent in a label and text can be in color. You're right. The example does not include the checkbox background color. It should.
font_background
# Title & Info text
Pop $MUI_HWND
ClearErrors # clear the error flag if the stack is empty
GetDlgItem ${TEMP1} $MUI_HWND 1200
SetCtlColors${TEMP1} 0x7E0117 transparent
GetDlgItem${TEMP1} $MUI_HWND 1201
SetCtlColors${TEMP1} 0x01AD4E transparent
# Checkboxes (finish page)
GetDlgItem ${TEMP1} $MUI_HWND 1202
SetCtlColors${TEMP1} 0x000000 0xD1D3B6
GetDlgItem${TEMP1} $MUI_HWND 1203
SetCtlColors${TEMP1} 0x000000 0xD1D3B6
FunctionEnd
>
Sorry if it's incomplete. If you want transparency, you're stuck with putting a label next to the checkbox. Also, if you don't like ${TEMP1}, use $1 or some other variable. I like ${TEMP1} because it jumps out in the script and is easy to spot.
TYT
14th May 2007 12:51 UTC
Sorry if it's incomplete.
buddy, i've used almost all of your script in my setup. You've got nothing to apologize for if I have to write a line or two. ;)
As for the labels with the checkboxes, i'll give that a try. I had read a similar thread stating that labels are the way to go, but I was looking for the holy grail of code that would allow me to have my checkboxes and background image also. ThanQ for the reply.
bnicer
14th May 2007 13:40 UTC
- Tom :)
bnicer
16th May 2007 04:53 UTC
A question ... that's been nagging me for a while and I ended up pushing it to one side. Shouldn't the bitmap be in the background? What if the change could be made backward compatible?
ioSpecial.ini
***93;
>Rect=1044
NumFields
=7
>***91;Field 1***93;
>Type=label
Left=120
Right=315
Top=10
>***91;Field 2***93;
>Type=label
Left=120
Right=315
>***91;Field 3***93;
***91;Field 4***93;
***91;Field 5***93;
***91;Field 6***93;
***91;Field 7***93;
>Type=bitmap
Left=0
Right=109
Top=0
Bottom=193
Flags=RESIZETOFIT
>
System.nsh
Assign the MUI welcome/finish page bitmap to field 7 and move all other fields up, Field 2 to Field 1, etc. Do the same for controls, 1201 to 1200, 1202 to 1201, ... The number of fields is seven. Replace
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "Numfields" "3" the first time (line 1190). Change the number to
"7", and remove code that sets the field number after that line.
I won't pretend it's the holy grail of code; it's only half as ugly. I'm almost afraid to ask: is it possible to implement?
TYT
16th May 2007 23:56 UTC
Good lord, I just got my checkboxes looking the way I want them to, dont go changing the code on me again! :P
bnicer
17th May 2007 10:16 UTC
Not imposing, I hope.
But you see the problem. When you add labels to the checkboxes, you're already on seven fields including the bitmap.
bnicer
17th May 2007 16:03 UTC
The bitmap field can be any number. Listing empty fields isn't required in the ini file. You can go from Field 2 to Field 100 and set the field number to 100. I didn't know. Oops, I changed the code again.
Change the bitmap to Field 100 - or would that be too obvious?
TYT
18th May 2007 00:11 UTC
Yeah, I changed the bitmap field to 7 when I added the checkbox labels, wasn't a problem.
As for adding empty fields to the .ini file, why? If I need to add anymore fields to the .ini file i'll just move the bitmap down to the last one.
and no, you're not imposing. As a matter of fact, I wouldn't have been able to figure this out on my own, so once again thanQ for all the help you've given. ;)
bnicer
18th May 2007 12:40 UTC
Thank you for your questions and you are most welcome. I'm glad I could help. :)
Below is a linked file (attachments aren't working) with the code changes. Leaving the first field empty might be better than moving all the fields up one (which I did), but I think either method might be possible. I'm hoping the approach is sound. Kichik, if you look at the code and tell me what to do next and your opinion, I would really appreciate it. Thank you.
link
kichik
23rd May 2007 18:11 UTC
Any field number change would break compatibility as some scripts relay on Field 1 to contain the bitmap, the second field to contain the header, etc.
What you could do to avoid all of the changes related to order is adding this simple System::Call to the show function.
!define SWP_NOSIZE 1
!define SWP_NOMOVE 2
!define SWP_NOACTIVATE 16
!define HWND_BOTTOM 1
!insertmacro MUI_INSTALLOPTIONS_READ $MUI_TEMP1 ioSpecial.ini "Field 1" "HWND"
System::Call `user32::SetWindowPos(i $MUI_TEMP1, i ${HWND_BOTTOM}, \
i 0, i 0, i 0, i 0, \
i ${SWP_NOSIZE}|${SWP_NOMOVE}|${SWP_NOACTIVATE})`
It'll move the bitmap to the back (HWND_BOTTOM).
bnicer
23rd May 2007 21:22 UTC
Thanks for your reply.
I had my sights set on a permanent feature, an end to changing the z-order forever. I can't imagine a script requiring the bitmap in front. Nobody would be able to tell a difference. The new field order would be compatible. I moved the other fields up to fill the gap. They could stay in place. Using MUI_WELCOMEFINISHPAGE_BITMAP and MUI_UNWELCOMEFINISHPAGE_BITMAP would be just as before, for instance, dynamically swapping the image if System.nsh and ioSpecial.ini already define Field 100 as the bitmap field.
Too bad. I bow to your wisdom.
A welcome/finish page show function in System.nsh is definitely ruled out, is it?
kichik
23rd May 2007 22:52 UTC
What if someone expects the image to be in Field 1? As soon as fields are moved, backward compatibility is broken.
I don't understand the second question. System.nsh already define the show functions. Are you talking about having that code in there by default?
bnicer
24th May 2007 04:19 UTC
For starters, I'm happy. Thank you again. It's amazing there is also a method that doesn't involve modifying System.nsh, the latter undoubtedly a plus-point.
Are you talking about having that code in there by default?
Just to see what would happen, instead of using it in my script, the intended use (I know), I tried the system call in System.nsh. The bitmap was moved to the back on the Welcome page. A further system call in the NSI script is still necessary to move the image on the Finish page.
What if someone expects the image to be in Field 1?
They'd be surprised. They're lucky it isn't my decision. I'm glad too it isn't my decision. It deserves to be your call.