Hi,
I have a button on my designer and an appropriate activity to handle the buttons events. click,up and down. All this is hooked up and working fine.
However what I want to do is pass the button into a class and then 'attach' additional events for click, down and up without impacting the original events.
My class is designed to add additional functionality to all buttons in my application. I tried this code below, but break points in the sub are not fired.
What I want is a simple call to hook up the extra functionality for the button, without having to add code to each button. Not sure if this is possible?
I have a button on my designer and an appropriate activity to handle the buttons events. click,up and down. All this is hooked up and working fine.
However what I want to do is pass the button into a class and then 'attach' additional events for click, down and up without impacting the original events.
My class is designed to add additional functionality to all buttons in my application. I tried this code below, but break points in the sub are not fired.
What I want is a simple call to hook up the extra functionality for the button, without having to add code to each button. Not sure if this is possible?
B4X:
Dim Obj1 As Reflector
Obj1.Target=InButton
Obj1.SetOnKeyListener("OnKey")
Sub OnKey(viewtag As Object, keycode As Int, keyevent As Object) As Boolean
'Code to react to button...
End Sub