Zilatica
23rd March 2010 22:25 UTC
SetCtlColors Using Variables
I'm using SetCtlColors and want to have the last value be a variable, but the text background is ALWAYS black.
I have tried
SetCtlColors $__TEXT "" $__WIN_COLOR
and
SetCtlColors $__TEXT "" "$__WIN_COLOR"
Where __WIN_COLOR is defined as one of the following definitions:
StrCpy $__WIN_COLOR "0x348017"
StrCpy $__WIN_COLOR 0x348017
IntOp $__WIN_COLOR "0x348017" + 0
IntOp $__WIN_COLOR 0x348017 + 0
IntOp $__WIN_COLOR "0x348017" + "0"
The only thing I can make work to give me green background (control color) is
SetCtlColors $__TEXT "" 0x348017
or
SetCtlColors $__TEXT "" "0x348017"
Every other option using a variable is treated as garbage and results in a black control background.
What am I missing?
pengyou
24th March 2010 01:12 UTC
From the User Manual:
4.9.14.15 SetCtlColors
hwnd [/BRANDING] [text_color] [transparent|bg_color]
Sets a background color and the text color for a static control, edit control, button or a dialog. text_color and bg_color don't accept variables.
Anders
24th March 2010 02:20 UTC
If you really really need to use variables (Why?) You would have to go into undocumented land and get the userdata with GetWindowLong with help from the system plugin. To get the layout of the userdata, you would have to check the nsis source (And needless to say, this struct could change in the future)
Zilatica
24th March 2010 14:28 UTC
Not too important
Eh, it isn't too important. I was using a variable to set red/green/yellow for bad/good/ok values on a minimum requirements dialog. Instead, I can set a variable and just run an if/elseif/else sequence. I just wondered if I was doing something stupid.
Thanks,
Zach