Skip to content
⌘ NSIS Forum Archive

Imagein description of a component

9 posts

Contex#

Imagein description of a component

Well, as it says in the title, I want to know if it is possible to insert an image in the discription of a component, if yes could anyone explain how?

Thanks, Contex

Here's a picture explaining where I want to have this image:
Animaether#
Not by default, no.

Probably the easiest method would be to reshack the modern UI resources and add a bitmap control the components page in exactly the spot you need it... you can load an image file into it from there.
Contex#
Alright so far I understand it but when I came to this word "bitmap control" my mind went crazy. 🤪 Any more explanation of it please 🙄 🙄. Or even an example would be the best if you have one.
Animaether#
outside the scope of this forum, really... start with getting the ResHacker (Resource Hacker) utility:



And have a peek at the Tutorials for it, for example:
http://www.*********/tutorial-all-ab...rief-tutorial/
Scroll down to 'Adding Newly added Resources in Dialog Boxes'.
MarcelP1977#
I want to do the same as in first post said.

Has anyone an example script how can i do it??

Please help me.

It would be nice if i can put an preview picture from my "installabel Logos" in components page.

Best Regards, Marcel.
Animaether#edited
'll reply in this thread - no point in resurrecting two

As per the above - you would have to use reshacker to first add a bitmap resource to the appropriate dialog. After that you'd have to adjust the code involved with changing the component description to change the image instead (or in addition).

For -most- of these things, though, I don't thin you'd want to use the component page at all. The component page has very little real-estate for textual descriptions as it is, let along images.

Why not create an nsDialogs page with a drop-down list or a flat listbox and a big image area, and then change the images on that. Once the user has made a choice, hide the other Sections, and select the section that corresponds to the skin that he user chose.
Edit: possibly because the changed image refuses to take on the bitmap control.. huh.
MarcelP1977#
How can i do that? Do you have example for me? 🙂

Or maybe i send you my (big) script and you can take a look?

Another question, i have also implemented follow tweak from the Wiki "Controlling Available Install Options". But it is descript for 4 elements, but i have 17!
When i adapt these script i have more then one elemts choosen the first time.
Animaether#
Originally Posted by MarcelP1977 View Post
How can i do that? Do you have example for me? 🙂
!addincludedir "."
!addplugindir "."
!include "LogicLib.nsh"
!include "MUI2.nsh"
!include "winMessages.nsh"
!include "nsDialogs.nsh"
OutFile "test.exe"
Section
SectionEnd
Var dialog
Var hwnd
Var null
Var hwnd_listbox
Var hwnd_bitmap
Var res_bmp
!macro RedrawControl control
    Push $0
    EnableWindow $0 0
    StrCpy $0 ${control}
    System::Call "user32::InvalidateRect(i,i,i)i (r0, 0, 1)"
    EnableWindow $0 1
    Pop $0
!macroend
!define RedrawControl `!insertmacro RedrawControl`
Page Custom customPage
Function customPage
    nsDialogs::Create 1018
    Pop $dialog
    InitPluginsDir
    SetOutPath "$PluginsDir"
        File "a.bmp"
        File "b.bmp"
    ${NSD_CreateListBox} 0 0 20% 100% ""
        pop $hwnd_listbox
        ${NSD_LB_AddString} $hwnd_listbox "Skin A"
        ${NSD_LB_AddString} $hwnd_listbox "Skin B"
        ${NSD_OnChange} $hwnd_listbox custompage.droplist.onchange
    ${NSD_CreateBitmap} 25% 0 190 171 ""
        Pop $hwnd_bitmap
    nsDialogs::Show
    ${NSD_FreeImage} $res_bmp
FunctionEnd
Function custompage.droplist.onchange
    Pop $hwnd
    SendMessage $hwnd ${LB_GETCURSEL} 0 0 $0
    ${If} $0 >= 0
        System::Call user32::SendMessage(i$hwnd,i${LB_GETTEXT},i$0,t.r1)
        ${Select} $1
            ${Case} "Skin A"
                StrCpy $3 "a.bmp"
            ${Case} "Skin B"
                StrCpy $3 "b.bmp"
            ${Default}
                StrCpy $3 "a.bmp"
        ${EndSelect}
    ${NSD_FreeImage} $res_bmp
    ${NSD_SetImage} $hwnd_bitmap "$PluginsDir\$3" $res_bmp
    ${EndIf}
FunctionEnd
!insertmacro MUI_LANGUAGE "English" 
Something like that.
*goes to figure out why this didn't work before*

Edit: Because I used $R0 for the filename and that gets overwritten in nsDialogs.. whoops.
MarcelP1977#
Nice, thanks, i will try this out.

Can you help me on another Thread?

This one:

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Thanks.