View Full Version : [Listbox] Change color of listitem & sort items alphabetically
Chieftec
13th November 2006, 17:04
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
14th November 2006, 20:29
Really nobody who can help?
Afrow UK
14th November 2006, 21:00
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
kichik
14th November 2006, 22:44
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.
davidnewcomb
3rd August 2007, 16:00
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,
Afrow UK
3rd August 2007, 16:29
!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
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.