Archive: Changing color ?


Changing color ?
Using the Modern UI is it possible to change the colors of the areas in the background. Please give a detailed example, I haven't got a clue.
I've attached a pic showing the areas I can't seem to change.


You have the same problem that I have... :(
Well... you can use the Resource Hacker to know the
Class ID of the rest of the areas.
And you're right... you know:
Maybe if there's, like "!define MUI_BGCOLOR", a !define to paint
all the dialogs :up: that will be cool.


It can be done like so:


!include WinMessages.nsh
# // Macro for making header
# // ===========================
!macro HEADER_TEXT TEXT SUBTEXT COLOUR
Push $0
Push $1
Push $2

GetDlgItem $2 $HWNDPARENT 1037
SendMessage $2 ${WM_SETTEXT} 0 "STR:${TEXT}"
GetDlgItem $0 $HWNDPARENT 1038
SendMessage $0 ${WM_SETTEXT} 0 "STR:${SUBTEXT}"
CreateFont $1 Verdana 10 700
SendMessage $2 ${WM_SETFONT} $1 0
GetDlgItem $2 $HWNDPARENT 1037
SetBkColor $2 "0x${COLOUR}"
GetDlgItem $2 $HWNDPARENT 1038
SetBkColor $2 "0x${COLOUR}"
GetDlgItem $2 $HWNDPARENT 1039
SetBkColor $2 "0x${COLOUR}"
GetDlgItem $2 $HWNDPARENT 1034
SetBkColor $2 "0x${COLOUR}"

Pop $2
Pop $1
Pop $0
!macroend


Page Custom CustomPage "" " - hello!"
Function CustomPage
!insertmacro HEADER_TEXT "Options Setup" " Enter options for your map to package..." "CCFFFF"
FunctionEnd


In the Macro, mess around with the GetDlgItem numbers (change e.g. 1034 to some other number.)

This is just like the one out of Modern UI, with added colours.
This macro only changes the header colour (bit at top) and places text on it.
You could add your own bits to it if you want, then just call the macro in a pre function of all your pages.

To get a colour code, use an HTML colour code: e.g. CCXXZZ and swap the end one around e.g. ZZCCXX (I think!)

-Stu

Thanks for the help. I've now managed to color most of the dialogs using the method below but there remain areas that can't be changed, see attached file. I assume these areas don't have controls so the method used for coloring the other areas can't be applied. Is there any other possible way to color these spaces?

!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
Function myGuiInit
SetBkColor $HWNDPARENT 0x00AB663D
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1020
SetBkColor $0 0x00AB663D
GetDlgItem $0 $HWNDPARENT 1028
SetBkColor $0 0x00AB663D
FunctionEnd


On the InstFiles page use
InstallColors 000000 AB663D

-Stu


Use:

FindWindow $0 "#32770" "" $HWNDPARENT
SetBkColor $0 0xFF00FF

to color the left areas. It's the same code for every page.


Thank-you kichik, it is finally working !


kichik is it possible to color the windows message boxes in the installer? Also how can the Next,Cancel etc buttons be colored? The code I use below colors only the outline of the buttons.

GetDlgItem $0 $HWNDPARENT 1 ;Button
SetBkColor $0 0x0082575B
GetDlgItem $0 $HWNDPARENT 2 ;Button
SetBkColor $0 0x0082575B
GetDlgItem $0 $HWNDPARENT 3 ;Button
SetBkColor $0 0x0082575B


You can't set the colors of the buttons without GetSysColors afaik. You might be able to if you subclass them but you'll need a plug-in for that.

As for the message box, see the other thread.


I'd just like to warn you about colouring in text fields.
On WinXP, the text within the fields get 'repeated' when you move the cursor through them.
Also, when you press the delete (backspace) key to delete text within these fields, the text does not get visually deleted until the user unclicks from that field.

-Stu


I don't have that problem...
I'll check it...just in case...


Thanks to kichik's knowledge and Lobo Lunar's persistance I've finally been able to color the installer almost exactly (still waiting/hoping for font colors and the start menu page) how I want to. The attached file contains pics of the installer plus the 'color' section of the script. Thanks again for the help.