Sergey_New Well-Known Member Licensed User Longtime User Apr 28, 2020 #1 I ask you to make an example of using B4XComboBox for B4A. I saw a videolesson from Erel, but for those who do not know English it is difficult to understand (
I ask you to make an example of using B4XComboBox for B4A. I saw a videolesson from Erel, but for those who do not know English it is difficult to understand (
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2020 #2 Tell us what you try and what happened. Start with: 1. Adding a reference to XUI Views library. 2. Add a B4XComboBox with the visual designer. Upvote 0
Tell us what you try and what happened. Start with: 1. Adding a reference to XUI Views library. 2. Add a B4XComboBox with the visual designer.
Sergey_New Well-Known Member Licensed User Longtime User Apr 30, 2020 #3 Did. The code works, but cmb is underlined, meaning it is not initialized. Why? B4X: Copy Sub Globals Dim cmb As B4XComboBox End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout(1) Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next cmb.SetItems(lst) End Sub Upvote 0
Did. The code works, but cmb is underlined, meaning it is not initialized. Why? B4X: Copy Sub Globals Dim cmb As B4XComboBox End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout(1) Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next cmb.SetItems(lst) End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2020 #4 Better to write "1" as the parameter is a string and not a number. It will probably remove the warning. Upvote 0
Better to write "1" as the parameter is a string and not a number. It will probably remove the warning.
Sergey_New Well-Known Member Licensed User Longtime User Apr 30, 2020 #5 Thank you, you are right! Last edited: Apr 30, 2020 Upvote 0
vmag Active Member Aug 20, 2020 #6 Hello! And I also get B4XComboBox not initialized and the program hangs on the phone, why? 1. Created a new B4XPages in B4A. 2. Checked that everything works on the device (received a message on the button- Hello World!) 3. Added B4XComboBox in the constructor, checked on the device- it appeared. 4. Added the code: B4X: Copy Sub Globals Public ChoiceR As B4XComboBox End Sub Sub Activity_Create(FirstTime As Boolean) Dim pm As B4XPagesManager pm.Initialize(Activity) Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next ChoiceR.SetItems(lst) End Sub The program is installed on the device, but when you start it freezes - there is no button or B4XComboBox, sometimes writes that B4XComboBox is not initialized. If you delete a line B4X: Copy ChoiceR.SetItems(lst) then everything works fine, but of course the B4XComboBox is empty and not active at all... Upvote 0
Hello! And I also get B4XComboBox not initialized and the program hangs on the phone, why? 1. Created a new B4XPages in B4A. 2. Checked that everything works on the device (received a message on the button- Hello World!) 3. Added B4XComboBox in the constructor, checked on the device- it appeared. 4. Added the code: B4X: Copy Sub Globals Public ChoiceR As B4XComboBox End Sub Sub Activity_Create(FirstTime As Boolean) Dim pm As B4XPagesManager pm.Initialize(Activity) Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next ChoiceR.SetItems(lst) End Sub The program is installed on the device, but when you start it freezes - there is no button or B4XComboBox, sometimes writes that B4XComboBox is not initialized. If you delete a line B4X: Copy ChoiceR.SetItems(lst) then everything works fine, but of course the B4XComboBox is empty and not active at all...
angel_ Well-Known Member Licensed User Longtime User Aug 20, 2020 #7 Add it to B4XMainPage: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("MainPage") Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next ChoiceR.SetItems(lst) End Sub Upvote 0
Add it to B4XMainPage: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("MainPage") Dim lst As List lst.Initialize For i=0 To 8 lst.Add(i) Next ChoiceR.SetItems(lst) End Sub
vmag Active Member Aug 20, 2020 #8 Thank you very much! Work correctly. Turns out I did everything right, but in the wrong place... Upvote 0