B4J Question ComboBox problem

kolbe

Active Member
Licensed User
Longtime User
I can't seem to figure this out. Using the internal designer I add a ComboBox to the layout. I load the layout and then use ComboBox1.Items.Add("item") to add the first item to the dropdown list. The app compiles and runs but if I click on the ComboBox the app hangs. I've tried Combobox.AddAll, I've added lists, strings. I've initialized both the ComboBox and the Combobox.Items, all with the same results. What am I doing wrong? My paths are set to Java 1.8. Feels like I am I missing the obvious.
 

inakigarm

Well-Known Member
Licensed User
Longtime User
Can you add your code? Have you seen the Debug Log (and you can attach it here) ?

If combobox is added to layout it has to work without initialize at code.
 
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
Can you add your code? Have you seen the Debug Log (and you can attach it here) ?

If combobox is added to layout it has to work without initialize at code.
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private Button1 As Button
    Private Label1 As Label
    Private ComboBox1 As ComboBox
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("main") 'Load the layout file.
    MainForm.Show
  
'    Dim list1 As List
'    list1.Initialize2(Array As Int(1,2,3))
    ComboBox1.Items.Add("one")
End Sub

It's the simplest.
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
That's why I told you about the Debug's Log

This code (same as yours) works fine (combobox added at Layout lyjtestcbx)

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ComboBox1 As ComboBox
    
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("lyjtestcbx") 'Load the layout file.
    MainForm.Show
    ComboBox1.Items.Add("item")
   
End Sub

B4J Paths:
B4X:
D:\Program Files\Java\jdk1.8.0_45\bin\javac.exe
 
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
There are no logs. Just, "Program Started". The app just freezes when I click on the ComboBox to bring down the dropdown list.

When I try to close the app it give me the Java not responding message.

My Java version is 51 not 45.
 
Upvote 0
Top