Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 13th November 2006, 17:04   #1
Chieftec
Junior Member
 
Join Date: Oct 2006
Posts: 27
[Listbox] Change color of listitem & sort items alphabetically

Hi,

I am using a list box in my custom page. If a checkbox is selected the selected item in the listbox should change its color. How I able to do this?

Still another question:
Is it possible to sort the items in the listbox alphabetically?

Thank you in anticipation
Chieftec is offline   Reply With Quote
Old 14th November 2006, 20:29   #2
Chieftec
Junior Member
 
Join Date: Oct 2006
Posts: 27
Really nobody who can help?
Chieftec is offline   Reply With Quote
Old 14th November 2006, 21:00   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Unless you want to write a plugin there is no way to change the colours for an individual list box item.
To sort the items it'd be easiest to use the NSIS Array plugin. You can add the items to an array with WriteListC, use Sort to sort the array and finally write back to the INI file with Concat. http://nsis.sf.net/File:NSISArray.zip

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 14th November 2006, 22:44   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You could also set the LBS_SORT style for the list by calling SetWindowLong using the System plug-in. If that doesn't work, you'd have to change the style on advance when creating it. For that you'd have to change the source code of InstallOptions.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 3rd August 2007, 16:00   #5
davidnewcomb
Junior Member
 
Join Date: Nov 2006
Location: Reading, UK
Posts: 39
Any chance you could give us the magic line to use "LBS_SORT" to sort list boxes. I can't find an example of that.
Thanks,
davidnewcomb is offline   Reply With Quote
Old 3rd August 2007, 16:29   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
code:
!define GWL_STYLE -16
!define LBS_SORT 0x0002L
System::Call `user32::GetWindowLong(i R0, i ${GWL_STYLE}) i.R1`
IntOp $R1 $R1 | ${LBS_SORT}
System::Call `user32::SetWindowLong(i R0, i ${GWL_STYLE}, i R1)`


Assuming $R0 contains the handle to your list box before you call it. Read it from the INI file HWND key or by using GetDlgItem.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump