add "custom" view? All I Show is Add ViewWhere do you create the B4XCombox view? It needs to be done in Designer.
Open designer, add custom view, select B4XCombobox, rename to cb1 (press enter), make it taller. Save as "combo".
Select tools, generate members, expand and select B4XCombobox and event.
In B4XMainPage where it says load layout, change name to "combo".
Then use code in post # 3. Don't define bc1 again in code.
If this is new to you, download and review booklets by @klaus.
https://www.b4x.com/android/files/Booklets.zip
I'm building a sample project to show the problem.drop down list of that shows all views, including custom view, select that and you'll get another list, select B4XCombobox
Got It Working! Thanks for all the help.I'm building a sample project to show the problem.
If I select Select B4XPages as project type,
Custom Views is dimmed out in the Designer drop down.
I added XUI Vies to Library and it shows up....
Dim cb As Spinner= B4XComboBox2.cmbBox
cb.AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4XComboBox2.SetItems(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4XComboBox2.cmbBox.As(Spinner).AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
Thanks,Glad you got it sorted out with Willy's help. Here is more stuff to throw at you:
These 3 variants are equivalent:
Or:B4X:Dim cb As Spinner= B4XComboBox2.cmbBox cb.AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
Or:B4X:B4XComboBox2.SetItems(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4X:B4XComboBox2.cmbBox.As(Spinner).AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
It is indeed a superb and very useful tool however I do have a problem with it. Having selected an item and then saving it away I want to be able to set the combox to that choice later. I cant find a way to do that. I tried setting the index and setting selected but always comes up with the initial setting. Any ideas?Glad you got it sorted out with Willy's help. Here is more stuff to throw at you:
These 3 variants are equivalent:
Or:B4X:Dim cb As Spinner= B4XComboBox2.cmbBox cb.AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
Or:B4X:B4XComboBox2.SetItems(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4X:B4XComboBox2.cmbBox.As(Spinner).AddAll(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4XComboBox1.SetItems(Array("Off","Steady","Xmas 1","Xmas 2","Help","Flash", "Wave"))
B4XComboBox1.SelectedIndex = 2