B4J Question call button click event from menu

tremara1

Active Member
Licensed User
Longtime User
I have searched high and low for the syntax for for callin a button click event. I still cannot find the correct way to do this. The button event is

btnAdd_MouseClicked (EventData As MouseEvent)

I want to call this from a menu item. I have tried and tried but cannot seem to the syntax right to fire the button click event. Anyone help??? Thanks
 

tremara1

Active Member
Licensed User
Longtime User
Sorry I should have inquired as to if you can do this in B4J.........
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
If you don't need any values from EventData, use btnAdd_Action insted of btnAdd_MouseClicked (EventData As MouseEvent).

Or you can do it that way:
Define a routine with the code, and call it from MouseClicked or from the menu.
B4X:
Sub btnAdd_MouseClicked (EventData As MouseEvent)
    MyRoutine
End Sub
'
'
Sub MyRoutine
    'your code
End Sub
Otherwise you would need to define a MouseEvent object with JavaObject to satisfy the signature of the MouseClicked event routine.
 
Upvote 0

tremara1

Active Member
Licensed User
Longtime User
Thanks Klaus I did that workaround ...I will also try the btn_Action.....
 
Upvote 0
Top