B4J Question [BANano]: [SOLVED] How to call different subs for different elements?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I have different subs in my code e.g.

B4X:
public Sub gogrid_Clicked(event As BANanoEvent)
    pgGrid.Init(App)
End Sub

public Sub golabels_Clicked(event As BANanoEvent)
    pgIndex.Init(App)
End Sub

Sub gobuttons_Clicked(Event As BANanoEvent)
    pgButtons.Init(App)
End Sub

Sub gobq_Clicked(Event As BANanoEvent)
    pgBlockQuote.Init(App)
End Sub

Id like to link each to an element id of its own so that they work separately.

B4X:
BANano.GetElement("#gogrid").HandleEvents("click", Me, "gogrid_Clicked")
BANano.GetElement("#golabels").HandleEvents("click", Me, "golabels_Clicked")
BANano.GetElement("#gobuttons").HandleEvents("click", Me, "gobuttons_Clicked")
BANano.GetElement("#gogq").HandleEvents("click", Me, "gogb_Clicked")
 
Top