Android Question How to add textchanged event to the customview of numpad?

watesoft

Active Member
Licensed User
Longtime User
I want to do other things automatically when I enter number in numpad, so I need a textchanged event.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Add this code to the class:
B4X:
#Event: TextChanged (Old As String, New As String)
Private Sub flEditText1_TextChanged (Old As String, New As String)
    CallSubDelayed3(CallBack, EventName & "_TextChanged", Old, New)
End Sub

You will see an "unexpected event" warning in the logs, in debug mode. Ignore it.
 
Upvote 0

watesoft

Active Member
Licensed User
Longtime User
Add this code to the class:
B4X:
#Event: TextChanged (Old As String, New As String)
Private Sub flEditText1_TextChanged (Old As String, New As String)
    CallSubDelayed3(CallBack, EventName & "_TextChanged", Old, New)
End Sub

You will see an "unexpected event" warning in the logs, in debug mode. Ignore it.
Thanks, I add above code to the class, it works well in B4A, but not in b4i, there are no errors or warnings during debugging, can't find the reason.
 
Upvote 0

watesoft

Active Member
Licensed User
Longtime User
True. It is related to the way the input is handled. Go over the code and raise this event whenever flEditText1.Text is set.
Many thanks,I try and it works well in B4I. There is one thing I don’t understand. I don’t know how to represent the first parameter. I left it blank, but it doesn’t affect the result. for example:
B4X:
Private Sub numpadButton_Click
    Dim b As Button = Sender
    If b.Text = "." And flEditText1.Text.Contains(".") Then Return
    flEditText1.Text = flEditText1.Text & b.Text
    flEditText1_TextChanged ("", flEditText1.Text)' I left first parameter blank'
End Sub
 
Upvote 0
Top