Bug? Error when using TabPane.Visible

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

getting an error when trying to set tabpane.visible = false. See below.

B4X:
Sub Process_Globals
    Private tabpaneTableViewCustom As Node
...

Sub AppStart (Form1 As Form, Args() As String)
    tabpaneTableViewCustom.Visible = False
...

Program started.
main._appstart (java line: 70)
java.lang.RuntimeException: Object should first be initialized (Node).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:28)
    at anywheresoftware.b4j.objects.NodeWrapper.setVisible(NodeWrapper.java:144)
    at b4j.example.main._appstart(main.java:70)
    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:606)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:33)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
    at java.lang.Thread.run(Thread.java:744)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

tried using jFX v1.01, but still got an error msg:

B4X:
 //BA.debugLineNum = 80;BA.debugLine="tabpaneTableViewCustom.Visible = False    ' This does not work";
_tabpanetableviewcustom.setVisible(anywheresoftware.b4a.keywords.Common.False);
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
My mistake. Tab is not a Node. You cannot treat as a node.

You can use this code to change the tab text and then remove it:
B4X:
Dim jtabPane As JavaObject = tabpainMain
Dim tabs As List = jtabPane.RunMethod("getTabs", Null)
Dim jtableviewCustom As JavaObject = tabs.Get(1) 'second tab
jtableviewCustom.RunMethod("setText", Array As Object("test"))
tabs.RemoveAt(1)
You can later add it back to the list.
 
Top