Skip to content
⌘ NSIS Forum Archive

Change the component Background color

23 posts

Joel#

Change the component Background color

Is there a way to change the Background color of the component list,
Change the "white" block with, for example, the customize color define in BGColor 🧟?

If not, that would be a cool new feature for next release....

👍
kichik#
TVM_SETBKCOLOR should do the trick:

!define TVM_SETBKCOLOR 0x111D
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SETBKCOLOR} 0 0xFF00FF 
Put this in the post creation function of the components page.

This will work on:
Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
virtlink#
So it should be:
Windows 2000 and above, Windows NT 4.0 and above with Internet Explorer 4.0 and above, Windows 98 and above, Windows 95 with Internet Explorer 4.0 and above, Windows XP and above
Joel#
Ok, I try it, no error...that's good 🙂, but is still showing the white color 🙁, put this... (may be I'm wrong)...

Function PaintComp
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SETBKCOLOR} 0 FF00FF
FunctionEnd

Page components PaintComp
kichik#
That's almost right. You need to make this function the post creationg function. That means:

Page components "" PaintComp
deguix#
This line is wrong:

SendMessage $0 ${TVM_SETBKCOLOR} 0 FF00FF 
So try this code:

!define TVM_SETBKCOLOR 0x111D
Page components "" PaintComp
Function PaintComp 
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SETBKCOLOR} 0 0xFF00FF
FunctionEnd 
It works fine for me!🙂
Joel#
Nothing

no, 🙁

here is my script
deguix#
Hmmm... Have to be a modification in "{NSISDIR}\Contrib\Modern UI\System.nsh" to easy this work to change components box color. Now it's impossible to use !define MUI_COMPONENTSPAGE and change this in the same time. Maybe a !define_COMPONENTSPAGE_COLOR should be added.
Joel#
Yeah, !define_COMPONENTSPAGE_COLOR should be added to match the set of BGCOLOR and Installcolors... hope Nsis creators take this as a feature in next CVS

👍
kichik#
A nicer way to change this color will be added in version b2. For b1, Joost is working on an easier way to change page functions (pre, show and leave) in the MUI.
Joost Verburg#
I added a new way of customizing the Modern UI Functions. Example:

!define MUI_CUSTOMFUNCTION_COMPONENTS_SHOW changeCompColor

Function changeCompColor
...change the color...
FunctionEnd
Joel#
ok...Now I have this:

!define MUI_CUSTOMFUNCTION_DIRECTORY_SHOW "changeTextColor"

Function changeTextColor
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1019
SendMessage $0 ${WM_CTLCOLOREDIT} 0 0xFCF1E1
FunctionEnd
I try to change the background color of the edit control,
The textbox, wich contains the Instalation path.

But still showing in white... whats wrong
kichik#
You need to receive that message and respond to it, not send it. That is not currently possible with NSIS.