Archive: Best way to change background color?


Best way to change background color?
I have a custom page. With some text boxes

                
${NSD_CreateNumber} 0 15 50% 12u "Message Here"
Pop $LABEL
SetCtlColors $LABEL ${RED} ${RED}



I've been trying to change the BG colors for these text boxes. All that code does is change the BG color to black and you cant see the text. If there a better way to do this? Also I would like to make the text inside the box to not be edited how do you do this. Not alot of info on NSD_CREATE

what is RED defined as?

for nsDialogs examples, see the Wiki category:
http://nsis.sourceforge.net/Category:NsDialogs_Examples

of particular interest for you might be:
http://nsis.sourceforge.net/Color_In..._for_nsDialogs
and
http://nsis.sourceforge.net/NsDialogs_FAQ

Here'a s skeleton example:


!addplugindir "."
!addincludedir "."

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"

!include "MUI2.nsh"

OutFile "test.exe"

!define Black 0x000000
!define LightRed 0xff8080

var dialog
var hwnd
var null

Page custom nsDialog

Function nsDialog
nsDialogs::Create 1018
${NSD_CreateText} 0 0 100% 8% "Hello world"
Pop $hwnd
SetCtlColors $hwnd ${Black} ${LightRed}
SendMessage $hwnd ${EM_SETREADONLY} 1 0

nsDialogs::Show
FunctionEnd

Section
SectionEnd
!insertmacro MUI_LANGUAGE "English"

Thanks for your help... I was able to change the BGcolor but now I'm trying to change the BG color depending on what I get back from hwinfo here is the code I made maybe I'm going about it all wrong. This just turns the box black.


HwInfo::GetSystemMemory
strCpy $R0 $0
${NSD_CreateText} 75 20 18% 12u "$0 MB"
Pop $Text


IntCmp $0 3900 isrec lessrec morerec
lessrec:
IntCmp $0 1900 ismin lessmin moremin

lessmin:
SetCtlColors $Text ${BLACK} ${RED}
goto endofram

isrec:
morerec:
SetCtlColors $Text ${BLACK} ${GREEN}
goto endofram
ismin:
moremin:
SetCtlColors $Text ${BLACK} ${Yellow}
endofram:

Use LogicLib.

Stu


I Tried that too


HwInfo::GetSystemMemory
strCpy $R0 $0
${NSD_CreateText} 75 20 18% 12u "$0 MB"
Pop $Text
${If} $0 >= '3900'
SetCtlColors $Text ${BLACK} ${GREEN}
${ElseIf} $0 >= '1900'
SetCtlColors $Text ${BLACK} ${Yellow}
${ElseIf} $0 < '1900'
SetCtlColors $Text ${BLACK} ${RED}
${EndIf}


Just turns the box black

Nevermind I got it working.