westereng Member Licensed User Nov 27, 2020 #1 Hello! Cant seem to find any info on this in the forums, so I'l ask then In c# I have the ability to define a custom event like this: C#: public event EventHandler MyEvent; and then subscribe to that event like this: C#: myObject.MyEvent += new EventHandler(myObject_MyEvent); and then we can invoke it like this for example: C#: MyEvent?.Invoke(this, e); Is there a similar concept in B4J? /Ronny
Hello! Cant seem to find any info on this in the forums, so I'l ask then In c# I have the ability to define a custom event like this: C#: public event EventHandler MyEvent; and then subscribe to that event like this: C#: myObject.MyEvent += new EventHandler(myObject_MyEvent); and then we can invoke it like this for example: C#: MyEvent?.Invoke(this, e); Is there a similar concept in B4J? /Ronny
Erel B4X founder Staff member Licensed User Longtime User Nov 29, 2020 #2 Find XUI Views.b4xlib in the internal libraries folder. Unzip it. Yes, it is a simple zip file. You will see many examples of custom views. Example from B4XSwitch: B4X: 'Declaration for IDE: #Event: ValueChanged (Value As Boolean) B4X: 'default XUI custom view template: Public Sub Initialize (Callback As Object, EventName As String) mEventName = EventName mCallBack = Callback End Sub Event: B4X: CallSubDelayed2(mCallBack, mEventName & "_ValueChanged", mValue) Upvote 0
Find XUI Views.b4xlib in the internal libraries folder. Unzip it. Yes, it is a simple zip file. You will see many examples of custom views. Example from B4XSwitch: B4X: 'Declaration for IDE: #Event: ValueChanged (Value As Boolean) B4X: 'default XUI custom view template: Public Sub Initialize (Callback As Object, EventName As String) mEventName = EventName mCallBack = Callback End Sub Event: B4X: CallSubDelayed2(mCallBack, mEventName & "_ValueChanged", mValue)
westereng Member Licensed User Nov 29, 2020 #3 thank you Erel, exactly what I’m looking for. Upvote 0