Scream81
9th July 2009 14:10 UTC
How to show preview pics for each section?
Hi
I made an installer that can install a fex iconpacks.
Now it would be nice if I could show a preview of each section maybe between the set section and size line to the left of sections list?
How could I do that? ideas?
Thanks alot
Afrow UK
10th July 2009 12:05 UTC
You need to add a bitmap control (either at run time using CreateWindowEx or using Resource Hacker) then you can set the bitmap using the LoadImage and SendMessage with ${STM_SETIMAGE} in the MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION event.
Stu
Scream81
10th July 2009 12:25 UTC
thanks I'll try that..
Afrow UK
10th July 2009 12:39 UTC
Some code here that should help you:
http://nsis.sourceforge.net/Image_in...dow_background
You basically want X custom variables to store the handles to your X images you should load in !define MUI_CUSTOMFUNCTION_GUIINIT myOnGUIInit using LoadImage and then destroy in .onGUIEnd using DeleteObject.
If you add the bitmap control using Resource Hacker you then just need to use STM_SETIMAGE with IMAGE_BITMAP in the MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION event with the image handle (stored in your custom variable).
Note as the manual says, the section id/index is stored in $0. The first section will be index 0, second index 1 and so on. You can therefore use an ${If} $0 == 0 ... ${ElseIf} $0 == 1 ... to load the correct image (or use a ${Switch}).
Stu
Boyito
10th July 2009 13:25 UTC
HI Afrow in the sample code ive an error when compile
LicenseData: open failed "bgbitmap.nsi"
Usage: LicenseData local_file_that_has_license_text | license_lang_string
Error in macro MUI_PAGE_LICENSE on macroline 21
Error in script "C:\NSIS\Image in installer window background.nsi" on line 58 -- aborting creation process
Where i could find "bgbitmap.nsi"?
Afrow UK
10th July 2009 13:28 UTC
bgbitmap.nsi is the script you are compiling. The license is a dummy - just use any text file.
Stu
Boyito
10th July 2009 13:31 UTC
Ups, sorry, thanks
Scream81
10th July 2009 16:01 UTC
hmm okay..
your code looks usefull for me, but I can't understand it well... so the recource hacker variant looks easier...
but how do I use Recource Hacker for this? I open modern_smalldesc and insert control, chouse Bitmap and set position..
but how can I use this in NSIS code?
Sorry I'm really new to this...
Afrow UK
10th July 2009 16:54 UTC
Give your bitmap control a unique id, then in the MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION you need to get a handle to the control using:
FindWindow $R0 `#32770` `` $HWNDPARENT
GetDlgItem $R0 $R0 bitmap_control_id
...Where bitmap_control_id is the id number you assigned using Resource Hacker.
Also to use the UI (if you haven't already) you need to use it by using !define MUI_UI ui_file.exe.
Stu
Scream81
10th July 2009 20:38 UTC
Thanks Afrow UK
I got it working now.. I haven't used resource hacker cause I couldn't get it to work, maybe wrong ID? don't know...
but the method from the link worked fine...
changed it from onmouseover to on select :)
Scream81