yaniv hanya Active Member Licensed User Jul 17, 2019 #1 Hi I have this sub Code: Copy Sub SetColor Dim sp As Panel=Sender Dim str() As String = Regex.Split(" ",sp.Tag) colorPnl.Color=Colors.RGB(str(0),str(1),str(2)) colorStr=sp.Tag End Sub and it is running very good. but when I put a breakpoint inside the sub sp is not initialized, the app crushs and i get this log Spoiler java.lang.RuntimeException: Object should first be initialized (Panel). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50) at anywheresoftware.b4a.objects.ViewWrapper.getTag(ViewWrapper.java:261) at java.lang.reflect.Method.invoke(Native Method) 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.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262) at b4a.example.setledcolor._setcolor(setledcolor.java:168) at b4a.example.setledcolor._panel5_click(setledcolor.java:322) at java.lang.reflect.Method.invoke(Native Method) 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.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent(BA.java:176) at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80) at android.view.View.performClick(View.java:5675) at android.view.View$PerformClick.run(View.java:22641) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6251) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) Do you have any idea why
Hi I have this sub Code: Copy Sub SetColor Dim sp As Panel=Sender Dim str() As String = Regex.Split(" ",sp.Tag) colorPnl.Color=Colors.RGB(str(0),str(1),str(2)) colorStr=sp.Tag End Sub and it is running very good. but when I put a breakpoint inside the sub sp is not initialized, the app crushs and i get this log Spoiler java.lang.RuntimeException: Object should first be initialized (Panel). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50) at anywheresoftware.b4a.objects.ViewWrapper.getTag(ViewWrapper.java:261) at java.lang.reflect.Method.invoke(Native Method) 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.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262) at b4a.example.setledcolor._setcolor(setledcolor.java:168) at b4a.example.setledcolor._panel5_click(setledcolor.java:322) at java.lang.reflect.Method.invoke(Native Method) 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.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent(BA.java:176) at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80) at android.view.View.performClick(View.java:5675) at android.view.View$PerformClick.run(View.java:22641) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6251) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) Do you have any idea why
DonManfred Expert Licensed User Longtime User Jul 17, 2019 #3 yaniv hanya said: Sub SetColor Dim sp As Panel=Sender Click to expand... what should this line do? there is no sender in a normal sub, only in a button_click event for ex. Upvote 0
yaniv hanya said: Sub SetColor Dim sp As Panel=Sender Click to expand... what should this line do? there is no sender in a normal sub, only in a button_click event for ex.
Jmu5667 Well-Known Member Licensed User Longtime User Jul 17, 2019 #4 DonManfred said: what should this line do? there is no sender in a normal sub, only in a button_click event for ex. Click to expand... It look like _panel5_click is calling setcolor Upvote 0
DonManfred said: what should this line do? there is no sender in a normal sub, only in a button_click event for ex. Click to expand... It look like _panel5_click is calling setcolor
DonManfred Expert Licensed User Longtime User Jul 17, 2019 #5 It is just a guess. Even then it would not work like this. Upvote 0
yaniv hanya Active Member Licensed User Jul 17, 2019 #6 I have a few buttons that are supposed to change the color of a panel (the colorPnl) And all their click events point to this function. By identifying the sender I decide which to color to change the panel. As mentioned above it works fine but when I try to debug the project and put a breakpoint then it falls. Upvote 0
I have a few buttons that are supposed to change the color of a panel (the colorPnl) And all their click events point to this function. By identifying the sender I decide which to color to change the panel. As mentioned above it works fine but when I try to debug the project and put a breakpoint then it falls.
Jmu5667 Well-Known Member Licensed User Longtime User Jul 17, 2019 #7 can you just send the panel as a parameter to the setcolor function Upvote 0
yaniv hanya Active Member Licensed User Jul 17, 2019 #8 That's what I did at the end. Thanks Upvote 0