I'm tried to learn InputListAsync() ,but I don't understand it 's not like as
MsgboxAsync(). I 've ever studied Aeric's code
it's different to using xui.DialogResponse_Cancel ,and In Button3_click module ,I can't declare inputlistAsync (there is message warning undeclare inputlistAsync before)
How to resolve Button3_click module's code?
MsgboxAsync(). I 've ever studied Aeric's code
B4X:
'The old code
' Dim Res As Int
' Res = InputList(l, "Choose a printer", -1) 'show list with paired devices
' If Res <> DialogResponse.CANCEL Then
' Serial1.Connect(PairedDevices.Get(l.Get(Res))) 'convert the name to mac address
' Return True
' End If
'-----------------------------------------------------------------------------
'The new code
InputListAsync(l, "Choose a printer", 0, False)
Wait For InputList_Result (res As Int)
If res <> DialogResponse.CANCEL Then
Serial1.Connect(PairedDevices.Get(l.Get(res))) 'convert the name to mac address
Return True
End If
it's different to using xui.DialogResponse_Cancel ,and In Button3_click module ,I can't declare inputlistAsync (there is message warning undeclare inputlistAsync before)
How to resolve Button3_click module's code?
B4X:
Private Sub Button3_Click
'old code
' Dim lstitems As List
' lstitems.Initialize
' lstitems.AddAll(Array As String("Item #1", "Item #2", "Item #3", "Item #4"))
'หรือ
' Dim lstitems As List = Array("Item #1", "Item #2", "Item #3", "Item #4")
' Dim res As Int = fx.InputList(MainForm, lstitems, "Please choose an item", "Select Data", 0)
' If res >= 0 Then
' Log($"Selected item: ${lstitems.Get(res)}"$)
' Else
' Log("User didn't select any item.")
' End If
'-----------------------------------------------------------------------------------------
'new code
' Dim lstitems As List
' lstitems.Initialize
' lstitems.AddAll(Array As String("Item #1", "Item #2", "Item #3", "Item #4"))
'หรือ
Dim lstitems As List = Array("Item #1", "Item #2", "Item #3", "Item #4")
Dim res As Object=inputlistAsync(lstitems,"please choose an item","Select Data",0)
Wait For (res) InputList_Result (myresult As Int)
If myresult <> xui.DialogResponse_Cancel Then
Log($"Selected item: ${lstitems.Get(myresult)}"$)
Return True
Else
Log("User didn't select any item.")
End If
End Sub