B4J Question [SOLVED] Events in customview

jroriz

Active Member
Licensed User
Longtime User
I created a very simple custom view with only one textview and the action and textchanged events.
It happens that if I use customview in some module, I am forced to code the events, even in blank, otherwise the error below occurs.

How to get around this? I used try endtry, but I found it kind of strange...

Error:
Field_textfield1_textchanged (java line: 161)

Java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Sub txtuid_textchanged was not found.

B4X:
'Custom View class
Sub Class_Globals
    Private fx As JFX
    Private mEventName As String 'ignore
    Private mCallBack As Object 'ignore
    Private mBase As Pane
    Public TextField1 As TextField
End Sub

Public Sub Initialize (Callback As Object, EventName As String)
    mEventName = EventName
    mCallBack = Callback
End Sub

Public Sub DesignerCreateView (Base As Pane, Lbl As Label, Props As Map)
    mBase = Base
    TextField1.Initialize("TextField1")
    Base.AddNode(TextField1, 0,0,0,0)
End Sub

Private Sub TextField1_Action
    ' Try - End Try?
    CallSub(mCallBack, mEventName & "_Action")
End Sub

Private Sub TextField1_TextChanged(Old As String,New As String)
    ' Try - End Try?
    CallSub2(mCallBack, mEventName & "_TextChanged",New)
End Sub

Private Sub Base_Resize (Width As Double, Height As Double)
   
End Sub

Public Sub GetBase As Pane
    Return mBase
End Sub
 
Top