I am writing an app that pulls data from a MySQL database. B4A has made that extremely easy to do.
The problem that I am having is that I cannot get a particular ScrollView to populate data on more than one panel.
I can see in the Log that there is more data there, and that i is getting incremented as it should.
Any help would be greatly appreciated.
Here is the code for response from the Database:
The problem that I am having is that I cannot get a particular ScrollView to populate data on more than one panel.
I can see in the Log that there is more data there, and that i is getting incremented as it should.
Any help would be greatly appreciated.
Here is the code for response from the Database:
B4X:
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim res As String
res = Response.GetString("UTF8")
Log("Response from server: " &TaskId&" - "& res)
Dim parser As JSONParser
parser.Initialize(res)
Select TaskId
Case TKT_HIST
'TODO: 5.17.12 - Make this code populate the scrollview with ticket history from the DB
'add the Ticket Details to the Views
Dim tickets As List
Dim PanelTop, PanelHeight, PanelWidth, RowS,RowH, Col1W, Col2W As Int
tickets = parser.NextArray 'returns a list with maps
resCount = tickets.Size -1
PanelTop = 5
RowS = 40
For i = 0 To resCount
Dim m As Map
m = tickets.Get(i)
'Fills the ScrollView with Data from the DB.
PanelHeight = 160dip
PanelWidth = 540dip
RowH = 40dip
Col1W = 140dip
Col2W = 400dip
pnlData.Initialize("pnlData")
lblDate.Initialize("lblDate")
lblTime.Initialize("lblTime")
lblUser.Initialize("lblUser")
lblNotes.Initialize("lblNotes")
lblLOC.Initialize("lblLOC")
pnlData.Color = Colors.Black
pnlBack.AddView(pnlData,0,PanelTop,PanelWidth,PanelHeight)
pnlData.Tag = i
pnlData.AddView(lblDate,0,PanelTop,Col1W,RowH)
lblDate.Tag = i
lblDate.TEXT = "Date: "& m.Get("Date")
pnlData.AddView(lblUser,0,RowS,Col1W,RowH)
lblUser.Tag = i
lblUser.TEXT = "User: "& m.Get("login")
pnlData.AddView(lblNotes,0,RowS * 2,PanelWidth,RowH * 2)
lblNotes.Tag = i
lblNotes.TEXT = "Notes: "& m.Get("timenotes")
pnlData.AddView(lblTime,Col1W,PanelTop,Col2W,RowH)
lblTime.Tag = i
lblTime.text = "Time: "& m.Get("start")&" to "&m.Get("end")
pnlData.AddView(lblLOC,Col1W,RowS,Col2W,RowH)
lblLOC.Tag = i
lblLOC.Text = "Location: "& m.Get("eventloc")
Log ("i = "&i&" - "&PanelTop)
PanelTop = PanelTop +PanelHeight+5
RowS = RowS + PanelTop
Next
'Case TIME_SAVE
'TODO: Create the result of saving time entries (show acknowledgement of save)
' ToastMessageShow("Time has been saved", False)
' txtNotes.Text = ""
' txtStartTime.Text = ""
' txtEndTime.Text = ""
End Select
ProgressDialogHide
Response.Release
End Sub