B4J Question Help. When I click on a combobox I want to run a subroutine

This has to be a question that has been answered, but I can't find a solution. Help.
I have 2 comboboxes (B4xComboboxes). I fill them and I can click a "Run" button and get what I want from the boxes. Fine, but when I click on a combobox (I get focus?) I want another sub to run (specifically to turn off a timer I have running). How do I do it?
I keep thinking I am making progress using B4x then I get stumped by simple stuff.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    B4XComboBox1.SetItems(Array("aaa", "bbb", "Ccc"))
    Dim r As Reflector 'reflection library
    r.Target = B4XComboBox1.mBase
    r.AddEventFilter("et", "javafx.scene.input.MouseEvent.MOUSE_PRESSED")
End Sub

Private Sub et_Filter(e As Event)
    Log("clicked")
End Sub

Private Sub B4XComboBox1_SelectedIndexChanged (Index As Int)
    Log(B4XComboBox1.GetItem(Index))
End Sub
I don't think that it will be too useful.
 
Upvote 0
I guess I have a lot more learning to do. I thought the solution might have to do with "reflection," but I have no idea what that actually is or how it works. So back to studying.
btw: it is very useful. It does exactly what I needed done.
Thank you very much.
 
Upvote 0
Top