nsisnsdialogs

Insert bitmap inside a nsis label


I am trying to construct a page with has a horizontal area with coloured background. I did this using an empty label. Displaying no text and just fill color inside it. On top on this now I want to add an image.

I ${NSD_CreateLabel} first and then after this wrote code for ${NSD_CreateBitmap} and ${NSD_SetImage}. I adjusted the X Y coordinates for image such that it sits on the label. However, when I compile script, I only see the label. No bitmap image is displayed on top of it.

Can someone help with this?


Solution

  • The z-index (depth) of created controls is not defined/documented but in your case you should be able to just swap them so the label is not on top of the image:

    Page Custom myPageCreate
    Page InstFiles
    
    !include nsDialogs.nsh
    Function myPageCreate
    nsDialogs::Create 1018
    Pop $0
    
    ${NSD_CreateBitmap} 30% 30% 80% 80% ""
    Pop $0
    File "/oname=$pluginsdir\img.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\arrow.bmp"
    ${NSD_SetImage} $0 "$pluginsdir\img.bmp" $1
    
    ${NSD_CreateLabel} 0 0 50% 50% "Hello"
    Pop $0
    SetCtlColors $0 000000 ff00cc
    
    nsDialogs::Show
    ${NSD_FreeImage} $1
    FunctionEnd