I made a class that essentially adds some features and properties to the label. I use a lot of these so I'd like to be able to target a particular instance without knowing which one was targeted.
For example
B4X:
Sub DataLabel_Click
Dim d as datalabel
d = sender
d.callSpecialMethodOfThisClass
End Sub
The actual sender in this case would be the click event of a real android label, so it doesn't have access to my methods.
A possible way to do it:
in the datalabel class make a click event sub which will call the activity that launched the datalabel, using a callsub or callsubdelayed -
B4X:
Sub Mylabel_click
If SubExists(Mmodule, "Datalabel_click") Then
CallSub3(Mmodule, "Datalabel_click", Me, someparameter)
End If
End Sub
In the calling activity (MModule) make a sub -
B4X:
Sub Datalabel_click(D As Datalabel,[some parameter] )
D.callSpecialMethodOfThisClass
End Sub