how to set background color for a listbox
Im trying to set background color for a listbox.Is it possible to set background color for a listbox?
Archive: how to set background color for a listbox
how to set background color for a listbox
Im trying to set background color for a listbox.Is it possible to set background color for a listbox?
Yes, it is. You need following:
- HWND of ListBox
- MSDN -> Name of message to do your task
- Know how to send windows messages. There is a lot of examples in the forum
:up:
Well, it isn't as hard as I thought. You need SetCtlColors instruction.
nsh
::Create /NOUNLOAD 1018
Name "ListBox Colors"
>OutFile "ListBox Colors.exe"
>Page custom nsDialogsPage
>Var LIST_1
>Var LIST_2
>Function nsDialogsPage
nsDialogs
Pop$0
${NSD_CreateListBox} 0 0 150 180 Test
Pop $LIST_1
SendMessage $LIST_1${LB_ADDSTRING} 0 "STR:Item"
SendMessage $LIST_1 ${LB_ADDSTRING} 0 "STR:Item"
SendMessage $LIST_1 ${LB_ADDSTRING} 0 "STR:Item"
SetCtlColors $LIST_1 0x3333CC 0xFFFFCC
${NSD_CreateListBox} 160 0 150 180 Test
Pop $LIST_2
SendMessage $LIST_2${LB_ADDSTRING} 0 "STR:Item"
SendMessage $LIST_2 ${LB_ADDSTRING} 0 "STR:Item"
SendMessage $LIST_2 ${LB_ADDSTRING} 0 "STR:Item"
SetCtlColors $LIST_2 0x990033 0xFFCC33
nsDialogs::Show
FunctionEnd
Section
SectionEnd
>
I have used the following code :
GetDlgItem $1 $HWND 1201
SetCtlColors $1 0xFFFFFF 191970
the listbox is created using ini.The color sets upon the selection of the items in the list box.How can i set the color at once instead of selecting individual items?
Do it my way! ;)
but i need to set the background color on a button event code looks like this :
Function LeaveCustom
ReadINIStr$0 "$PLUGINSDIR\showUserList.ini" "Settings" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $UserSelection "showUserList.ini" "Field 2" "State"
StrCmp $0 0 Done ; Next button?
StrCmp $0 3 SelectAll ; select all users
StrCmp $0 4 UnselectAll ; unselect all users
StrCmp $0 2 ListSelection
Abort ; Return to the page
SelectAll:
; MessageBox MB_OK|MB_ICONINFORMATION "Select All"
; StrCpy $0 SELECT_ALL
StrCpy $isSelectAll "1"
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 1
GetDlgItem $1 $HWND 1203
EnableWindow $1 1
;added on dec 04,2007
GetDlgItem $1 $HWND 1202
EnableWindow $1 0
GetDlgItem $1 $HWND 1201
SetCtlColors $1 0xFFFFFF 191970
;MessageBox MB_OK|MB_ICONINFORMATION "Go to next page"
; call InstallAllFiles
Abort
UnselectAll:
GetDlgItem $0 $HWND 1201
SetCtlColors $0 "transparent"
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 0
;MessageBox MB_OK|MB_ICONINFORMATION "Unselect All"
StrCpy $isSelectAll "0"
GetDlgItem $1 $HWND 1203
EnableWindow $1 0
;added on dec 04,2007
GetDlgItem $1 $HWND 1202
EnableWindow $1 1
Abort
- i want to set back color on clicking SelectAll button and on Clicking UnSelectAll i want the background to be transparent.Please reply me its urgent
hey thanks a lot its working fine....
Its urgent - FOR YOU.
I recommend you using nsDialogs instead of InstallOptions.