Android Question Drop-down list

ciginfo

Well-Known Member
Licensed User
Longtime User
Hello,
I don't find how to create a drop-down list in a form, like "<Select> Option..... </Select>" in Html.
Is there a special view in the designer? How to create it.
Thank you
 

ciginfo

Well-Known Member
Licensed User
Longtime User
Thank you. I find now B4Xcombobox and spinner, I place it with designer but is there a tuto ? I suppose it needs use code because désigner properties are succinct.
Thank you
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
but is there a tuto ? I suppose it needs use code because désigner properties are succinct

There is no tutorial per se. But the search in the forum of B4XComboBox yields a good bit of useful information. Here is a complete example I made just for you Monsieur CigInfo attached also with the full code below. You will see how it works.

B4X:
Sub Globals
    Private lstItems As List
    Private B4XComboBox2 As B4XComboBox  'need to check XUI Views Lib
    Private xui As XUI    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")  'layout has B4XComboBox2 only
    lstItems.Initialize
    lstItems.AddAll(Array As String("Dog", "Cat", "Bird", "Camel", "Tiger", "Elephant"))
    
'    'These 3 lines works also:  you can uncomment them if you want
'    Dim b As B4XView=B4XComboBox2.cmbBox  
'    b.SetColorAndBorder(xui.Color_Red, 5dip, xui.Color_Yellow, 10dip)    
'    B4XComboBox2.cmbBox.DropdownBackgroundColor =xui.Color_Magenta  'works
    
    B4XComboBox2.SetItems(lstItems)
        
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub B4XComboBox2_SelectedIndexChanged (Index As Int)
    Log(B4XComboBox2.GetItem(Index))
End Sub
 

Attachments

  • B4XComboBox052721.zip
    9.3 KB · Views: 322
Upvote 0
Top