Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   how to set background color for a listbox (http://forums.winamp.com/showthread.php?t=282725)

Shwetha 6th December 2007 09:48

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?

pospec 6th December 2007 12:11

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:

pospec 6th December 2007 16:38

Well, it isn't as hard as I thought. You need SetCtlColors instruction.
PHP Code:

!include nsDialogs.nsh

Name 
"ListBox Colors"
OutFile "ListBox Colors.exe"

Page custom nsDialogsPage

Var LIST_1
Var LIST_2

Function nsDialogsPage
    nsDialogs
::Create /NOUNLOAD 1018
    Pop 
$0

    
${NSD_CreateListBox0 0 150 180 Test
    Pop $LIST_1
    SendMessage $LIST_1 
${LB_ADDSTRING"STR:Item"
    
SendMessage $LIST_1 ${LB_ADDSTRING"STR:Item"
    
SendMessage $LIST_1 ${LB_ADDSTRING"STR:Item"
    
SetCtlColors $LIST_1 0x3333CC 0xFFFFCC
    
    
${NSD_CreateListBox160 0 150 180 Test
    Pop $LIST_2
    SendMessage $LIST_2 
${LB_ADDSTRING"STR:Item"
    
SendMessage $LIST_2 ${LB_ADDSTRING"STR:Item"
    
SendMessage $LIST_2 ${LB_ADDSTRING"STR:Item"
    
SetCtlColors $LIST_2 0x990033 0xFFCC33
    nsDialogs
::Show
FunctionEnd

Section
SectionEnd 


Shwetha 7th December 2007 04:38

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?

pospec 7th December 2007 04:44

Do it my way! ;)

Shwetha 7th December 2007 08:04

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

Shwetha 7th December 2007 08:57

hey thanks a lot its working fine....

pospec 7th December 2007 08:58

Its urgent - FOR YOU.

I recommend you using nsDialogs instead of InstallOptions.


All times are GMT. The time now is 05:14.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.