B4J Question Pane error on B4J LoadLayout

Discussion in 'B4J Questions' started by giga, Jun 23, 2015.

  1. giga

    giga Well-Known Member Licensed User

    I have been working on a project with no issue once I change to a AnchorPane. It will not open and I get this error:

    it is pointing to my layout
    Code:
    Sub AppStart (Form1 As Form, Args() As String)

       
        MainForm = Form1
        MainForm.RootPane.LoadLayout(
    "TData")
        MainForm.Show
    Code:
    Program started.
    Error occurred on line: 
    96 (main).
    java.lang.ClassCastException: java.lang.String cannot be cast 
    to anywheresoftware.b4a.ObjectWrapper
        at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:
    150)
        at b4j.example.main._appstart(main.java:
    230)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    601)
        at anywheresoftware.b4a.shell.Shell.runMethod(
    Shell.java:563)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:224)
        at anywheresoftware.b4a.shell.Shell.raiseEvent(
    Shell.java:156)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    601)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    93)
        at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:
    82)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    84)
        at b4j.example.main.start(main.java:
    36)
        at com.sun.javafx.application.LauncherImpl$
    5.run(LauncherImpl.java:319)
        at com.sun.javafx.application.PlatformImpl$
    5.run(PlatformImpl.java:206)
        at com.sun.javafx.application.PlatformImpl$
    4.run(PlatformImpl.java:173)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.access$
    100(WinApplication.java:29)
        at com.sun.glass.ui.win.WinApplication$
    3$1.run(WinApplication.java:73)
        at java.lang.Thread.run(
    Thread.java:722)
    Any ideas appreciated.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Based on the error message, you have declared a global string variable with the same name as one of the views.
     
    jmon likes this.
Loading...