Skip to content
⌘ NSIS Forum Archive

label transparents with background-image

15 posts

TobWen#

label transparents with background-image

Hey,

I've created a custom page with an image in the background.
Of course, the text-labels have gray background.

I've changed them the normal way (SetCtlColors).
It's possible to set every color, but transparency is always set to gray.
I think, it sets the color of the dialog behind the image, not the image itself.

Is there a work-around? I've searched already, but didn't find a working solution 🙁

Best regards,
Tobias
Afrow UK#
You may need to refresh the control. Easiest way to do this is to hide the control and then show it again using:

ShowWindow $R0 ${SW_HIDE}
ShowWindow $R0 ${SW_SHOW}

-Stu
TobWen#edited
  ; Give labels a transparent background
GetDlgItem $0 $0 1200
SetCtlColors $0 0xFFFFFF transparent
GetDlgItem $0 $0 1208
SetCtlColors $0 0xFFFFFF transparent

; Reload window
GetDlgItem $0 $HWNDPARENT 1
ShowWindow $0 ${SW_HIDE}
ShowWindow $0 ${SW_SHOW}
it only changes "item 1200" ... and it doesn't work for buttons :-(
Afrow UK#
You should change controls in the parent window (i.e. Next button, Back button etc) in .onGUIInit.

If you're using Modern UI then you'd need to !define MUI_CUSTOMFUNCTION_GUIINIT onGUIInit

-Stu
TobWen#
I mean checkboxes and their labels. I'm using classic UI.

But why is just the first label changed (1200) and not the second (1208) ?
TobWen#
here it is ...
Afrow UK#
Hmm strange. Transparent doesn't seem to be working for it at all. And by the way, the control ID is 1210 for the check box (it's Field 8 - 1 + 3)... +3 because each DirRequest control has two controls; the text box and the command button.

Interestingly, if I use transparent for its background and use XPStyle on, the background turns black!

Perhaps you should contact kichik about this (or wait for him to reply).

-Stu
kichik#
Check boxes are a bit problematic:

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.
kichik#
At least for the labels, you're using the wrong dialog item id. You should read the HWND value from the INI after calling initDialog. It's much simpler than calculating the correct id. To get the HWND of the browse button, read HWND2. Use:
ReadINIStr $0 "$PLUGINSDIR\options.ini" "Field 2" "HWND"
SetCtlColors $0 0x000000 transparent

ReadINIStr $0 "$PLUGINSDIR\options.ini" "Field 3" "HWND"
SetCtlColors $0 0x000000 transparent

ReadINIStr $0 "$PLUGINSDIR\options.ini" "Field 8" "HWND"
SetCtlColors $0 0x000000 transparent