Archive: color examples?


color examples?
  Could I please get some complete examples on how to color the dialogs and controls using nsis. I know I have had responses to my postings but have not once received a complete example and I cannot get the pieces to work. I searched the forums for examples but only found pieces of script related to color changing. Thanks in advance for the assistance. My goal is to get the background of all of the controls and dialogs colored white. I am using custom pages as well as the defaults with the modern UI.


It has been explained how you can change these colors. Please take some time to read the documentation / Modern UI Readme. If you have created a script and still have problems, attach it so people can have a look at it.


Here is an example script that does not seem to work for me....

!include "MUI.nsh"

Name "Color Test 1.0"
OutFile "colortest.exe"

Var HWND
Var DLGITEM

Page custom CustomPageA
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

ReserveFile "ioA.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

Section test

SectionEnd

Function .onInit

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"

FunctionEnd

Function CustomPageA

!insertmacro MUI_HEADER_TEXT "text1" "text2"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
Pop $HWND

GetDlgItem $DLGITEM $HWND 1078
SetCtlColors $DLGITEM FFFFFF FF0000
!insertmacro MUI_INSTALLOPTIONS_SHOW

FunctionEnd


How do you determine the dialog id number? I have tried several and still does not color anything?

ioA.ini ...


[Settings]
NumFields=2

[Field 1]
Type=label
Text=Install Options Page A
Left=0
Right=-1
Top=0
Bottom=10

[Field 2]
Type=label
Text=test text
Left=0
Right=-1
Top=20
Bottom=30


Please read the "Call InstallOptions" section in the Modern UI documentation. You have to use the InstallOptions initdialog/show macros.


Ok, have everythign working except the background color of the inner dialogs. what is the appropriate way to do this for the license page and custom pages. I also seem to have a problem with my header text not refreshing when I change pages. It just writes over the previous text.


You can find the inner dialog using:

FindWindow $R0 "#32770" "" $HWNDPARENT


I have everything working except I cannot figure out how to get the inner dialog of the license page to change color. Can someone please point me in the right direction. Where does it belong?


FindWindow $HWND "#32770" "" $HWNDPARENT
Pop $HWND

GetDlgItem $DLGITEM $HWND 102
SetCtlColors $DLGITEM 000000 FFFFFF


Try this (to work with custom pages):


"text1" "text2" 

>!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioA.ini"
>Pop $HWND

GetDlgItem $DLGITEM $HWND 1201;1201 is 1200 + Field Number - 1
SetCtlColors $DLGITEM FFFFFF FF0000
>!insertmacro MUI_INSTALLOPTIONS_SHOW
>
And to use with the license page, is complicated to explain in 30 minutes! Someone can answer it.

A suggestion:

Have a command to paint all the dialog background to a color (including external parts of controls).

All of this has worked but still unable to get the inner dialog of the license page to change color.


Which version of NSIS are you using?

-Stu


If SetCtlControls works, is using about the latest development snapshot. If someone don't answer first (that will occur), I will say all the controls to color (the external part of them) and how to paint the rest.


Originally posted by billym
All of this has worked but still unable to get the inner dialog of the license page to change color.
By the fact that you have mentioned only the license page I assume you're talking about the license data itself. This is set using LicenseBkColor.