M Mickster Active Member Licensed User Longtime User Jan 22, 2013 #1 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 Code: Copy 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. What would be the best way to achieve this? Last edited: Jan 22, 2013
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 Code: Copy 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. What would be the best way to achieve this?
derez Expert Licensed User Longtime User Jan 22, 2013 #2 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 - Code: Copy 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 - Code: Copy Sub Datalabel_click(D As Datalabel,[some parameter] ) D.callSpecialMethodOfThisClass End Sub Last edited: Jan 22, 2013 Upvote 0
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 - Code: Copy 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 - Code: Copy Sub Datalabel_click(D As Datalabel,[some parameter] ) D.callSpecialMethodOfThisClass End Sub
M Mickster Active Member Licensed User Longtime User Jan 22, 2013 #3 (If you saw my original response, it's because I hadn't noticed you passed 'me' as a parameter) I'll see how it does, thanks! Upvote 0
(If you saw my original response, it's because I hadn't noticed you passed 'me' as a parameter) I'll see how it does, thanks!