Skip to content
⌘ NSIS Forum Archive

MUI: change header text color for a page

7 posts

torikx#

MUI: change header text color for a page

Hi,
I'd like to change the color of header text for a *certain* page, how can I do that?
i.e.
!define MUI_PAGE_HEADER_TEXT "some text"
!define MUI_PAGE_HEADER_SUBTEXT "some subtext"

display "some text" in red, display "some subtext" in green, etc.
kichik#
Use GetDlgItem and SetCtlColors. To find out the item id, use Resource Hacker. Search the forum for GetDlgItem, SetCtlColors and/or Resource Hacker and you should be able to find some examples.
orhuidobro#
Originally Posted by kichik View Post
Use GetDlgItem and SetCtlColors. To find out the item id, use Resource Hacker. Search the forum for GetDlgItem, SetCtlColors and/or Resource Hacker and you should be able to find some examples.
Hello Kichik, I was able to change the text color in headings using your suggestions. 🙂
For example, in the Components Page:
GetDlgItem $r3 $HWNDPARENT 1037 ; "Choose Components"
SetCtlColors $r3 0xFFFFFF transparent
GetDlgItem $r3 $HWNDPARENT 1038 ; "Choose which features of..."
SetCtlColors $r3 0xffda00 transparent
I also need to change the text color in Welcome Page:
"Welcome to ... Setup"
"Setup will guide you through the installation..."
But I wasn't able to find the resource numbers for these text blocks. I used Resource Hacker, and found many Dialogs listed there, but it seems Welcome Page isn't there.

Is it possible to do what I want?
Can it be done just knowing the codes, or a different approach is needed?


Thanks and best regards.
Anders#
The Welcome page is a custom page, you can use WinSpy++ at run-time to find the control id. If you are using MUI2 you can look for the correct variable name in the MUI source or for MUI1 you might be able to read the HWND from the .ini.
orhuidobro#edited
Hi Anders, thank you for your timely response.
Looking to Modern UI\ioSpecial.ini, I wasn't able to figure out which are the resource numbers for these text blocks.
The .INI file is:
[Settings]
Rect=1044
NumFields=3
[Field 1]
Type=bitmap
Left=0
Right=109
Top=0
Bottom=193
Flags=RESIZETOFIT
[Field 2]
Type=label
Left=120
Right=315
Top=10
[Field 3]
Type=label
Left=120
Right=315
Could you please help me with a little piece of code, to change the text color in the Welcome page?

Thanks and best regards.
Anders#
The HWND only exists at run-time:

!include MUI.nsh
!include InstallOptions.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomeColors
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

Function WelcomeColors
!insertmacro INSTALLOPTIONS_READ $0 "ioSpecial.ini" "Field 2" "HWND"
SetCtlColors $0 0xff1133 transparent
!insertmacro INSTALLOPTIONS_READ $0 "ioSpecial.ini" "Field 3" "HWND"
SetCtlColors $0 0xaa00ff transparent
FunctionEnd