This is about the example accompanying XUI view library
When a single animal name is selected, I want to skip pressing the OK button, and close the dialog right way. How do I modify following code blocks to achieve that, if possible?
thanks
When a single animal name is selected, I want to skip pressing the OK button, and close the dialog right way. How do I modify following code blocks to achieve that, if possible?
thanks
B4X:
'set the search items
SearchTemplate.Initialize
Dim Items As List
Items.Initialize
For Each line As String In File.ReadList(File.DirAssets, "colors.txt")
Dim s() As String = Regex.Split(":", line)
Dim Name As String = s(0)
Items.Add(Name)
Next
SearchTemplate.SetItems(Items)
B4XFloatTextField1.NextField = B4XFloatTextField2
options.Initialize
options.Options = Array("Cat", "Dog", "Fish", "Crocodile")
options.AllowMultiSelection = False
options.MultiSelectionMinimum = 1
Sub btnOptions_Click:
Sub btnOptions_Click
'wrap it with a timed template
Dim TimedTemplate As B4XTimedTemplate
TimedTemplate.Initialize(options)
TimedTemplate.TimeoutMilliseconds = 10000 'close after 10 seconds (this is the default value)
Wait For (Dialog.ShowTemplate(TimedTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
If Result = XUI.DialogResponse_Positive Then
Dialog.Show($"You selected: ${options.SelectedItems.Get(0)}"$, "OK", "", "")
End If
End Sub