Wish default item in B4XListTemplate


Active Member
Licensed User
Longtime User
Thanks for the cross plattform dialogs. I really was waiting for it. Here three ideas:

1. The .SelectedItem property in B4XListTemplate (B4XDialog) seems to be only readable after the user action. It would be good, if you could also set a defaut item with that before the user action.

2. Also a integer property .SelectedIndex, to get and set the selected item position (if it is not .AllowMultiSelection) would be very usefull.

3. And beside .MultiSelectionMinimum it could also be .MultiSelectionMaximum. If it is set to 1, I could create a SingleSelection dialog with default selected item, acceptable just with "OK" or changable, very usefull.


B4X founder
Staff member
Licensed User
Longtime User
You can preselect an item with this code:
Dim rs As ResumableSub = Dialog.ShowTemplate(ListTemplate, "", "", "Cancel")
Dim Selected As Int = 3 '4th item
ListTemplate.CustomListView1.GetPanel(Selected).Color = ListTemplate.SelectionColor
Wait For (rs) Complete (Result As Int)
(Tested in B4J)