B4J Question Combobox not showing anything when I click on it.

Tim Chapman

Active Member
Licensed User
Longtime User
I have created the combobox in my layout file.
I have populated it with 3 items.
The items.size shows 3.
But when I click on the combobox, it drops down with a blank box and won't trigger any events when clicked on.
The index remains -1 if I click on it. I have searched the forum and asked OpenAI to see if it can find a solution as well.
No luck.
I would appreciate anyone's help on this.
The code is attached.
 

Attachments

  • InvoiceMaker.zip
    9.8 KB · Views: 5
Solution
I would appreciate anyone's help on this.
You should NEVER inititalize Views which are loaded by a Layout!!

Replace
B4X:
cmbReseller.Initialize("cmbReseller")
with
B4X:
    'cmbReseller.Initialize("cmbReseller")
or just remove that line.

The event-signature was wrong too.

it must be

B4X:
Private Sub cmbReseller_SelectedIndexChanged(Index As Int, Value As Object)
    Log(cmbReseller.Items.Get(Index))  
End Sub

The combobox works and the event is raised.

DonManfred

Expert
Licensed User
Longtime User
I would appreciate anyone's help on this.
You should NEVER inititalize Views which are loaded by a Layout!!

Replace
B4X:
cmbReseller.Initialize("cmbReseller")
with
B4X:
    'cmbReseller.Initialize("cmbReseller")
or just remove that line.

The event-signature was wrong too.

it must be

B4X:
Private Sub cmbReseller_SelectedIndexChanged(Index As Int, Value As Object)
    Log(cmbReseller.Items.Get(Index))  
End Sub

The combobox works and the event is raised.
 
Last edited:
Upvote 0
Solution

Tim Chapman

Active Member
Licensed User
Longtime User
You should NEVER inititalize Views which are loaded by a Layout!!

Replace
B4X:
cmbReseller.Initialize("cmbReseller")
with
B4X:
    'cmbReseller.Initialize("cmbReseller")
or just remove that line.

The event-signature was wrong too.

it must be

B4X:
Private Sub cmbReseller_SelectedIndexChanged(Index As Int, Value As Object)
    Log(cmbReseller.Items.Get(Index)) 
End Sub

The combobox works and the event is raised.
Thank you Don. I wish I had half of your experience with programming!
 
Upvote 0
Top