Sub Globals
Private xui As XUI
Private Dialog As B4XDialog
Private base As B4XView
Private btnfrom As SwiftButton
Private SearchTemplateairport As B4XSearchTemplate
Private index As Object
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("cities")
SearchTemplateairport.Initialize
base = Activity
Dialog.Initialize (base)
btnfrom.Enabled = False
Dim ser As B4XSerializator
ser.ConvertBytesToObjectAsync(File.ReadBytes(File.DirAssets, "index"), "ser")
Wait For ser_BytesToObject (Success As Boolean, NewObject As Object)
index = NewObject
btnfrom.Enabled = True
End Sub
Sub btnfrom_click
SearchTemplateairport.SetIndex(index)
wait for (Dialog.ShowTemplate(SearchTemplateairport, "", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Dim airport As String =SearchTemplateairport.Selecteditem
btnfrom.xLBL.Text = airport.substring2(0,3)
End If
End Sub