Hello.
After switching to a 4.3 version of the project, ABMList Clicked stopped working. Update libraries 4.25 to 4.3 done. page.NeedsList = True is.
How to solve it ?
Sub Page_ParseEvent(Params As Map)
Dim eventName As String = Params.Get("eventname")
Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))
Log("Event->"&eventName)
and got the result:
Event-> 1_clicked when I click on the item in the list
where I am:
B4X:
Dim lista As ABMList
lista.Initialize (page, "lista", ABM.COLLAPSE_EXPANDABLE, "lista")
page.Cell (3.1) .AddComponent (lista)
B4X:
Sub lista_Clicked(ItemId As String)
Dim t As String = DBMh.SQLSelectSingleResult2("select title from faq where idx=?", Array As String(ItemId))
Dim v As String = DBMh.SQLSelectSingleResult2("select value from faq where idx=?", Array As String(ItemId))
Dim okno As ABMModalSheet = page.ModalSheet("AddModal")
Dim tyt As ABMLabel = okno.Content.Component("tyt")
Dim tresc As ABMEditor = okno.Content.Component("edit")
tyt.Text = t
tresc.SetHTML(v)
tyt.Refresh
tresc.Refresh
If page.IsDesktop Then
tyt.FontSize("34px")
Else
tyt.FontSize("14px")
End If
page.ShowModalSheet("AddModal")
End Sub
it is weird that your get an event like 1_clicked. How do you add items to the list? Just checked and I can't find anything changed between 4.25 and 4.30
I followed the trail that @alwaysbus gave, checking adding items to the list.
B4X:
Dim list As ABMList = page.Component("lista")
Dim wynik As List
wynik = DBMh.SQLSelect("select * from faq")
For i =0 To wynik.Size-1
Dim m As Map = wynik.Get(i)
Dim pos As Int = i+1
list.AddItemWithTheme(m.Get("idx"),tytul(pos&". "&m.Get("title")),"poz")
Next
list.Refresh
B4X:
Sub tytul(value As String) As ABMLabel
Dim a As ABMLabel
a.Initialize(page,"1",value, ABM.SIZE_H5,True,"pozycja")
a.Clickable = True
If page.IsDesktop Then
a.FontSize("24px")
Else
a.FontSize("14px")
End If
Return a
End Sub
And something like that does not work. However, I noticed that I gave there as id label "1" which did not bother with version 4.25.
After changing to:
B4X:
Sub tytul(value As String) As ABMLabel
Dim a As ABMLabel
a.Initialize(page,value,value, ABM.SIZE_H5,True,"pozycja")
a.Clickable = True
If page.IsDesktop Then
a.FontSize("24px")
Else
a.FontSize("14px")
End If
Return a
End Sub
B4X:
Event->lista_clicked
Everything is moving and working. But what effect does id_label have on the ABMList I do not know?
Sub tytul(value As String) As ABMLabel
Dim a As ABMLabel
a.Initialize(page,"1",value, ABM.SIZE_H5,True,"pozycja")
a.Clickable = False
If page.IsDesktop Then
a.FontSize("24px")
Else
a.FontSize("14px")
End If
Return a
End Sub
It works too. In version 4.25 as was a.Clickable = True it worked.
The most important thing is that the problem is solved.
Thank you for the tip.
Isn't it faster for a single call to the database better than running two whilst returning different fields in the same query? And then parse that query result? Or the impact is rather insignificant?
B4X:
Dim t As String = DBMh.SQLSelectSingleResult2("select title from faq where idx=?", Array As String(ItemId))
Dim v As String = DBMh.SQLSelectSingleResult2("select value from faq where idx=?", Array As String(ItemId))
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.