The InputList function in B4A is deprecated.
The B4XDialog (XUI Views library) with a B4XListTemplate (mentioned by
@zed ) is a good alternative.
Some sample code:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Public keuzedialog As B4XDialog
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Private Sub Button1_Click
keuzedialog.Initialize(Root)
keuzedialog.PutAtTop = True
keuzedialog.BackgroundColor = Colors.White
Dim width As Int = GetDeviceLayoutValues.Width - 10dip
Dim height As Int = GetDeviceLayoutValues.Height - 100dip
Dim keuzelst As List
keuzelst.Initialize
keuzelst.Add("id1 - een heel lange tekst voor de eerste keuze die normaal gezien niet op 1 regel kan.")
keuzelst.Add("id2 - een korte tekst")
keuzelst.Add("id3 - een redelijk korte naam")
Dim listtpl As B4XListTemplate
listtpl.Initialize
listtpl.Resize(width,height)
listtpl.Options = keuzelst
listtpl.CustomListView1.AsView.SetLayoutAnimated(0, 0dip, 0dip, width - 10dip, height)
listtpl.CustomListView1.sv.SetLayoutAnimated(0, 0dip, 0dip, width - 10dip, height)
listtpl.CustomListView1.DefaultTextBackgroundColor = xui.Color_White
listtpl.CustomListView1.DefaultTextColor = xui.Color_Black
keuzedialog.ButtonsHeight = 50dip ' set to 1dip to force the user to select
Wait For (keuzedialog.ShowTemplate(listtpl, "", "", "Cancel")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
xui.MsgboxAsync(listtpl.SelectedItem,"Selected item")
End If
End Sub
View attachment 157328
But as you can see the first line is still longer than one line. The CustomListView from the template uses text items.
Another way to use a list is to use a B4XDialog with a custom layout.
Private Sub Button1_Click
keuzedialog.Initialize(Root)
keuzedialog.PutAtTop = True
keuzedialog.BackgroundColor = Colors.White
Dim width As Int = GetDeviceLayoutValues.Width - 10dip
Dim height As Int = GetDeviceLayoutValues.Height - 100dip
Dim keuzelst As List
keuzelst.Initialize
keuzelst.Add("id1 - een heel lange tekst voor de eerste keuze die normaal gezien niet op 1 regel kan.")
keuzelst.Add("id2 - een korte tekst")
keuzelst.Add("id3 - een redelijk korte naam")
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0dip, 0dip, 0dip,width - 10dip, height)
pnl.LoadLayout("keuzedialog_layout")
fill_clv1
Dim rsub1 As ResumableSub = keuzedialog.ShowCustom(pnl, "OK", "", "")
Wait For (rsub1) Complete (Result As Int)
If Result = xui.dialogResponse_Positive Then
'
End If
End Sub
Private Sub fill_clv1
For i = 0 To keuze.Length -1
Dim pnl As Panel = clv1_item(keuze(i))
clv1.Add(pnl,i)
Next
End Sub
Private Sub clv1_item(naam As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0dip, 0dip, clv1.AsView.Width,40dip)
p.LoadLayout("clv1item_layout")
lblnaam.Text = naam
Return p
End Sub
Private Sub clv1_ItemClick (Index As Int, Value As Object)
Log(clv1.GetValue(Index))
clv1.GetPanel(Index).GetView(0).Color = xui.Color_Green
End Sub
View attachment 157329
In the custom layout (clv1item_layout) the lblnaam label Single Line property is checked. This causes the text to be truncated.
You can also use a B4XComboBox that also has a Single Line property you can check.
View attachment 157330
Or you can use a Spinner.
View attachment 157331
To answer your question: i don't think it is possible to set the items from an InputList to a single line (no wrapping).