I fill a scrollview, it takes a frrw seconds. So I want a progressbar or something like that. Therefore, during the filling of the scrollview, I need a DoEvents statement. But then it is impossible to scroll!
Any ideas?
Any ideas?
B4X:
For iz=0 To cr.Rowcount-1
cr.position=iz
aid=cr.GetString ("AID")
na=cr.GetString ("name")
nu=cr.Getstring ("number")
' Log (na)
isasked = cr.getint ("isasked")
iscontact=cr.GetInt ("iscontact")
Dim pnlpers As Panel
pnlpers.Initialize("pnlpers")
pnlpers.Color=Main.ptealcolor
Scroll.Panel.AddView(pnlpers,0dip,iz*hei,Scroll.Width,hei)
pnlpers.Tag=s
Dim shoplbl As Label
shoplbl.Initialize ("shoplbl")
If Basis.ispad=True Then
Basis.dolabel (shoplbl,na & " / " & nu)
Else
Basis.dolabel (shoplbl,na & CRLF & nu)
End If
shoplbl.Gravity = Gravity.CENTER
If iscontact=1 Then
shoplbl.color=Main.a200color
shoplbl.TextColor=Colors.White
Else If isasked=1 Then
shoplbl.color=Main.a100color
shoplbl.TextColor=Colors.White
End If
pnlpers.AddView(shoplbl,3dip, 3dip, Scroll.Width-6dip, hei-6dip)
Dim Contacts2 As Contacts2
Dim listOfContacts As List
listOfContacts = Contacts2.FindByName(na, True, False, False)
Dim l As Label
l.Initialize ("l")
If listOfContacts.Size > 0 Then
Dim Contact As Contact
Contact = listOfContacts.Get(0)
Log(Contact) 'will print the fields to the LogCat
Dim photo As Bitmap
photo = Contact.GetPhoto
If photo <> Null Then
pnlpers.AddView(l,3dip, 3dip, hei-6dip, hei-6dip)
l.SetBackgroundImage(photo)
End If
End If
Dim m As Map
m.Initialize
m.Put ("aid",aid)
m.Put ("name",na)
m.Put ("number",nu)
m.Put ("isasked",isasked)
s=Basis.MapToJSON (m,True)
shoplbl.Tag=s
' when I leave this uncommented, the scrollview is unscrollable
' DoEvents
Next
Scroll.Panel.Height=(cr.rowcount)*hei
' Msgbox (Scroll.Panel.Height,cr.rowcount)
Scroll.height=100%y
Scroll.color=Main.lbcolor