- NSIS Discussion
- Add an icon in Finish page
Archive: Add an icon in Finish page
JonCan
5th December 2003 11:26 UTC
Add an icon in Finish page
Hi everybody!
I want to add an exclamation icon to the Finish page, and i have 2 questions :
1. Are there any parameters to select an exclamation icon in the ioSpecial.ini, like MB_ICONEXCLAMATION for messagebox ?
2. How can i do to implement this icon in the Finish page, but not in the Welcome page, using the custome ioSpecial.ini ? Maybe a possibility to disable/enable or visible/notvisible it..?
Thank you!!
Joost Verburg
5th December 2003 16:25 UTC
Write to the Finish page INI file in the pre function and set the icon in the show function using the System plug-in and Windows API.
JonCan
5th December 2003 20:56 UTC
Thanks..but I don't really know how to use all that stuff, so i try something else : to let the icon blank for welcome page, and activate the icon by giving it the "text" value of my exclamation icon.
And now i have another problem, i want to change the background color of an element, i try this code, but it doesn't work :
!define MUI_SPECIALINI "Welcome_Finish.ini"
!define MUI_CUSTOMFUNCTION_FINISH_PRE FinishCustom
...
Function FinishCustom
Pop $R0
GetDlgItem $R1 $R0 1203
SetBkColor $R1 0x000000
Pop $R1
FunctionEnd
...
The background of my field 4 is still grey..What's wrong?
Thanks for your help
JonCan
5th December 2003 21:35 UTC
I try this and it's ok! :
!define MUI_SPECIALINI "Welcome_Finish.ini"
!define MUI_CUSTOMFUNCTION_FINISH_SHOW FinishCustom
...
Function FinishCustom
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1203
SetBkColor $R1 0xFFFFFFFF
FunctionEnd
...
:)
JonCan
5th December 2003 22:14 UTC
Another probleme...
I can't modify the INI :
!define MUI_SPECIALINI "Welcome_Finish.ini"
!define MUI_CUSTOMFUNCTION_FINISH_SHOW FinishCustom
...
Function FinishCustom
!insertmacro MUI_INSTALLOPTIONS_WRITE "Welcome_Finish.ini" "Field 4" "Text" "Hello" ;This doesn't work
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1203
SetBkColor $R1 0xFFFFFFFF
FunctionEnd
...
any idea? thanks
JonCan
5th December 2003 22:49 UTC
:rolleyes: me again...
I notice that my special INI file for Welcome and Finish page doesn't work well (the field i've add doesn't appear) when i use the MUI_FINISHPAGE_SHOWREADME
not easy to be a newbie :(
kichik
6th December 2003 13:13 UTC
You've mixed up the callbacks. You should write to the INI in the pre function, not the show function:
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)
And to get the HWND of the Welcome/Finish page you use $MUI_HWND in the show function, not the pre function:
In the Show function of Welcome page and the Finish page, $MUI_HWND contains the HWND of the inner dialog
Both are said assuming you're using NSIS 2.0 b4 or a later version.
BTW, Joost was talking about the System plug-in as a method to get the system's exclamation mark instead of a set one you bring with the installer. The System plug-in can call Win32 API functions that can get you this icon. But I think you should first get the basic, with your own icon working and only then, if you want, get the system's exclamation mark.
JonCan
6th December 2003 15:02 UTC
Thanks for you answer, but it sill not working..:(
Now my code is :
!define MUI_SPECIALINI "Welcome_Finish.ini"
!define MUI_CUSTOMFUNCTION_FINISH_PRE FinishCustomSetText
!define MUI_CUSTOMFUNCTION_FINISH_SHOW FinishCustomSetColor
...
Function FinishCustomSetText
!insertmacro MUI_INSTALLOPTIONS_WRITE "Welcome_Finish.ini" "Field 5" "Text" "Hello"
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Welcome_Finish.ini" "Field 5" "Text"
MessageBox MB_OK "$R0"
FunctionEnd
Function FinishCustomSetColor
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1203 ;GetDlgItem $R1 $R0 1203
SetBkColor $R1 0xFFFFFF
GetDlgItem $R2 $R0 1204 ;GetDlgItem $R2 $R0 1204
SetBkColor $R2 0xFFFFFF
FunctionEnd
The FinishCustomSetColor function is OK. It works. (Notice that $MUI_HWND doesn't work).
But the FinishCustomSetText function doesn't work, it's strange, because my messagebox print me the good value ("Hello"), but my Label element in my Finish page doesn't change, it doesn't print hello, the text value is not modified.
I don't undertsand.
And i have always the same problem when i define the MUI_FINISHPAGE_SHOWREADME value: all my added fields in my ini are not visible.
Thanks for your help!
kichik
6th December 2003 15:17 UTC
You still need to write to ioSpecial.ini as MUI_SPECIALINI just changes the source. As for $MUI_HWND, it works fine for me and it is the best way to go because under certain circumstances FindWindow will not find the window you expect it to find. It probably isn't working for you because you're using 2.0b3. In 2.0b3 you should use ${MUI_TEMP1}:
MUI_CUSTOMFUNCTION_FINISH_SHOW - ${MUI_TEMP1} contains HWND of Finish dialog
JonCan
6th December 2003 15:40 UTC
Yes! Thanks Kichik! it works!
In fact i don't really know which version i have, my compiler shows
"NSIS v2.0b4 (CVS) fr" and my NSIS.exe shows "NSIS v2.02 beta 2 fr"... so.. don't know! maybe a mix!
Last thing : what can I do about the MUI_FINISHPAGE_SHOWREADME problem ? when i define the MUI_FINISHPAGE_SHOWREADME value all the fields i've added in my ini are not visible.
kichik
6th December 2003 16:20 UTC
Mixing up versions is not a good idea... The MUI depends on new features in makensis.exe and so do other parts of the NSIS package. You should get NSIS 2.0b4, read the MUI readme again, update your script according to it (MUI_CUSTOMFUNCTION_FINISH_PRE -> MUI_PAGE_CUSTOMFUNCTION_PRE, MUI_SPECIALINI -> MUI_WELCOMEFINISHPAGE_INI, etc.). The mix up is probably the cause to the trouble with MUI_FINISHPAGE_SHOWREADME.