For my project, I use an SQL database, each line contains all the data of a panel to add to my customListView.
On my panel of customListView I have to enter the date with this form: "21 Nov 2018"
I managed to add my SQL lines to my customListView with this sub:
And for insert a new panel in my list view I would like to insert it in chronological order.
At first I have the date in three variables:
I typed a new variable named Date :
I intend to create a sub that compares the dates and returns the most recent.
My problem is that once the panel is added to my customListView, I can not get my Date variable.
I could only get the date with an iv.lbl.text in the form:"21 Nov 2018"
I would like to find a way to "attach" my Date variable to my panel.
Do you have a track to give me?
I would prefer to avoid having to create three invisible labels to store these variables.
Because I think it's going to take a long time to deal with.
On my panel of customListView I have to enter the date with this form: "21 Nov 2018"
I managed to add my SQL lines to my customListView with this sub:
B4X:
Private Sub OpenActiveFile As Boolean
If File.Exists(PathPhone,ActiveFile) = False Then
Serveur.Download(ActiveFile)
Return False
End If
If SQLactif.IsInitialized = False Then
SQLactif.Initialize(PathPhone, ActiveFile, False)
End If
For i=0 To CommandeSQL.NbLigne(SQLactif)-1
Dim l As LigneSQL = CommandeSQL.ExtractLigne(SQLactif,i+1)
Dim iv As itemValue
iv.Initialize
CLV.Add(CreateItemLigneCompte(Fonction.DateNumToStr(l.date),NomUtilisateur,l.nature,l.prix,l.sended,iv),60dip,iv)
DateOnIndex.Put(i,l.date)
If l.sended = 0 Then
SQLneedUpload = True
End If
Next
Log($"
La liste : ${ActiveFile} à bien été ajoutée
"$)
Return True
End Sub
Public Sub DateNumToStr(date As Date) As String
Dim moisStr As String
Select date.mois
Case 1
moisStr="Janv."
Case 2
moisStr="Fev."
Case 3
moisStr="Mars"
Case 4
moisStr="Avril"
Case 5
moisStr="Mai"
Case 6
moisStr="Juin"
Case 7
moisStr="Juil."
Case 8
moisStr="Août"
Case 9
moisStr="Sept."
Case 10
moisStr="Oct."
Case 11
moisStr="Nov."
Case 12
moisStr="Dec."
End Select
Dim r As String = date.jour & " " & moisStr & " " & date.annee
Return r
End Sub
And for insert a new panel in my list view I would like to insert it in chronological order.
At first I have the date in three variables:
- days
- month
- year
I typed a new variable named Date :
B4X:
Type Date (jour As Int, mois As Int,annee As Int)
I intend to create a sub that compares the dates and returns the most recent.
My problem is that once the panel is added to my customListView, I can not get my Date variable.
I could only get the date with an iv.lbl.text in the form:"21 Nov 2018"
I would like to find a way to "attach" my Date variable to my panel.
Do you have a track to give me?
I would prefer to avoid having to create three invisible labels to store these variables.
Because I think it's going to take a long time to deal with.