SORT the elements in ClsCheckList

stefanoa

Active Member
Licensed User
Longtime User
1) there's a way to SORT the elements in lstaudio (ClsCheckList) ?

what's the syntax?
B4X:
Dim lstAudio As ClsCheckList
....
lstAudio.SortItems(????,0,lstAudio.NumberOfItems,True)   '????

2) when i have the HEADER (Artists), how can i sort the elements (ex. by Artist/Songs) ??
B4X:
If Artist <> DernArtist Then
   lstAudio.AddHeader(Artist)
   DernArtist = Artist
End If
   
lstAudio.AddItemNoChkbx(fm.Get("ID" & ix), fm.Get("Title" & ix), fm.Get("Location" & ix), Null)
....

So i have:

>> Artist 1
>> song1
>> song2
>> Artist 2
>> songA
>> songB

3) when i set HEADER (lstAudio.AddHeader...) there is a way to obtain the INITIAL LETTER of header elements with ClsScrollPanel ? (so only initial of artists and not of songs)

thanks
 

elbelli2013

Member
Licensed User
Longtime User
Hi, maybe this help You.


Dim myContact As Contact

Dim map1 As Map
map1.Initialize

Dim list1 As List
list1.Initialize

For i = 0 To Main.listOfContacts.Size - 1 'List of all contactas

myContact = Main.listOfContacts.Get(i)
list1.Add(myContact.DisplayName)
map1.Put(myContact.DisplayName, myContact)
Next

list1.Sort(True)


Done, now You need add elements in clscheklist



For i = 0 To list1.Size - 1

myContact = map1.Get(list1.Get(i))
photo = myContact.GetPhoto


If photo <> Null Then
b1 = photo
Else
b1 = imgDefault
End If


If myContact.phonenumber<>"" Then lst.AddItem(i, False, myContact.phonenumber, myContact.Name,b1)

Next



regards.
 
Upvote 0
Top