Joey249
Member
I've added in my custom controls as followed from Erel's Tutorial, everything is working as expected but when I try and grab the controls from a TextChanged event B4xpages always crashes with an error message. The code i'm trying to use works perfectly in other areas, it just has an issue with the TextChanged event as I presume i'm doing it incorrectly for that event.
Here's the code for that segment
This is the way Erel demonstrated the usage of the code for a button click event at 16:39 in his video, however i'm sure a text event is different i'm just not quite sure how to go about it, i've tried a For loop which works but then it also has to update all other controls which don't need updating all the time and causes a delay as a result of it.
If anyone has any examples on how to go about this it would be greatly appreciated.
Error Message while loading the page:
Here's the code for that segment
B4X:
Private Sub TxtServiceQty_TextChanged (Old As String, New As String)
Dim index As Int = ListViewServices.GetItemFromView(Sender)
Dim iv As ItemValue = ListViewServices.GetValue(index)
iv.LblTotalPrice.text = iv.TxtServicePrice.Text * iv.TxtServiceQty.text
End Sub
This is the way Erel demonstrated the usage of the code for a button click event at 16:39 in his video, however i'm sure a text event is different i'm just not quite sure how to go about it, i've tried a For loop which works but then it also has to update all other controls which don't need updating all the time and causes a delay as a result of it.
B4X:
Private Sub TxtServiceQty_TextChanged (Old As String, New As String)
For i = 0 To ListViewServices.Size - 1
Dim iv As ItemValue = ListViewServices.GetValue(i)
iv.LblTotalPrice.text = iv.TxtServiceQty.Text * iv.TxtServicePrice.Text
Next
End Sub
If anyone has any examples on how to go about this it would be greatly appreciated.
Error Message while loading the page:
B4X:
Error occurred on line: 69 (TestServicePage)
java.lang.ClassCastException: b4a.example.b4xfloattextfield cannot be cast to android.view.View
at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:91)
at anywheresoftware.b4a.objects.B4XViewWrapper.getParent(B4XViewWrapper.java:188)
at b4a.example3.customlistview._getitemfromview(customlistview.java:413)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1114)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1077)
at b4a.example.b4xfloattextfield._tf_textchanged(b4xfloattextfield.java:1145)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:7424)
at android.widget.TextView.setText(TextView.java:3822)
at android.widget.TextView.setText(TextView.java:3671)
at android.widget.EditText.setText(EditText.java:80)
at android.widget.TextView.setText(TextView.java:3646)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.B4XViewWrapper.setText(B4XViewWrapper.java:229)
at b4a.example.b4xfloattextfield._settext(b4xfloattextfield.java:886)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.testservicepage._b4xpage_created(testservicepage.java:85)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1087)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1070)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:427)
at b4a.example.b4xpages._showpage(b4xpages.java:44)
at b4a.example.createappointmentpage._btnaddservice_click(createappointmentpage.java:121)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at andr
Message longer than Log limit (4000). Message was truncated.