B4J Question combobox , how to set visible raws count programatically

Erel

Administrator
Staff member
Licensed User
You can add items to the Items property:
B4X:
cmb.Items.Add("New Item")
 

Erel

Administrator
Staff member
Licensed User
B4X:
Dim jo As JavaObject = ComboBox1
jo.RunMethod("setVisibleRowCount", Array(20))
 

Daestrum

Well-Known Member
Licensed User
You can get strange results from this as it seems to depend on the order you do things.

combo created in designer in both cases

1,
load layout
show form
add items
try to resize - size is wrong (seems to be just over 1 line high)
no resize - combo shows correct number of rows from designer.

2,
load layout
add items
show form
resize works as expected.

Maybe someone could confirm this
 

Erel

Administrator
Staff member
Licensed User
Maybe you should remove and add the items after you change this property.
 

rwblinn

Well-Known Member
Licensed User
Hi,

have tested (using latest version = JavaFX 8u40) "load layout, show form, add items, change visible rowcount" without issues.

See attached example.
 

Attachments

Top