Private Sub et_TextChanged (Old As String, New As String)
If New.Length = 0 Then
lv.Clear
lv.Visible = False
Else
If lv.Visible = False Then lv.Visible = True
Dim j As HttpJob
j.Initialize("", Me)
j.Download2("https://maps.googleapis.com/maps/api/place/autocomplete/json", _
Array As String("input", New & " Tegucigalpa&types=establishment", "key", GlobalParameters.GoogleApiKey))
QueryIndexSent = QueryIndexSent + 1
Dim index As Int = QueryIndexSent
Wait For (j) JobDone (j As HttpJob)
If j.Success Then
If QueryIndexReceived > index Then
Return
Else
Dim pds As List
pds.Initialize
lv.Clear
QueryIndexReceived = index
Dim jp As JSONParser
jp.Initialize(j.GetString)
Dim m As Map = jp.NextObject
Dim predictions As List = m.Get("predictions")
For Each pred As Map In predictions
Dim pd As PlaceData
pd.Initialize
pd.Id = pred.Get("place_id")
pd.Description = pred.Get("description")
pds.Add(pd)
Next
AddItemsToList(pds, New.ToLowerCase)
End If
End If
j.Release
End If
End Sub