Hello adjust TableView columns as in figure 1 (design) is shown but supplemented with data and change the width is not as I want to see picture 2 (Implementation)
I found a solution: ( you need to use the lib I wrote jScriptEngine)
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private tab1 As TableView
Private js As jScriptEngine ' need to add this to libs
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("tabres1") 'Load the layout file.
tab1.SetColumns(Array As String("One","Two","Three"))
MainForm.Show
js.enginePut("tab1",tab1)
js.evalString("tab1.setColumnResizePolicy(tab1.CONSTRAINED_RESIZE_POLICY);")
End Sub
The result is you get three columns, not the default 'what you want plus one'.
Dim JO As JavaObject = Tab1
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
Dim JO As JavaObject = Tab1
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Tab1 As TableView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
Dim JO As JavaObject = Tab1 'Tab1 is a TableView defined in layout "1"
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
MainForm.Show
End Sub
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Tab1 As TableView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
Dim JO As JavaObject = Tab1 'Tab1 is a TableView defined in layout "1"
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
MainForm.Show
End Sub
Parsing code. 0.01
Compiling code. Error
Error compiling program.
Error description: Referencia a objeto no establecida como instancia de un objeto.
Occurred on line: 51
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
Word: getfield