Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
tv.Initialize("tv")
MainForm.RootPane.AddNode(tv, 0, 0, 250, 250)
tv.SetColumns(Array As String("col1", "col2"))
For i = 1 To 100
Dim lbl1, lbl2 As Label
lbl1.Initialize("")
lbl2.Initialize("")
lbl1.Text = i
lbl2.Text = i
lbl1.Font = fx.DefaultFont(Rnd(10, 20))
lbl2.Font = fx.DefaultFont(Rnd(10, 20))
lbl1.TextColor = fx.Colors.From32Bit(Rnd(0x80000000, -1))
lbl2.TextColor = fx.Colors.From32Bit(Rnd(0x80000000, -1))
tv.Items.Add(Array As Object(WrapLabel(lbl1, "CENTER") , _
WrapLabel(lbl2, "CENTER_RIGHT")))
Next
End Sub
Sub WrapLabel(lbl As Label, Alignment As String) As Pane
Dim pn1 As AnchorPane
pn1.Initialize("")
pn1.AddNode(lbl, 0, 0, -1, -1)
pn1.FillHorizontally(lbl, 0, 0)
Dim jo1 = lbl As JavaObject
jo1.RunMethod("setAlignment", Array As Object(Alignment))
Return pn1
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
tv.Initialize("tv")
MainForm.RootPane.AddNode(tv, 0, 0, 250, 250)
tv.SetColumns(Array As String("col1", "col2"))
For i = 1 To 100
Dim lbl1, lbl2 As Label
lbl1.Initialize("")
lbl2.Initialize("")
lbl1.Text = i
lbl2.Text = i
lbl1.Font = fx.DefaultFont(Rnd(10, 20))
lbl2.Font = lbl1.Font
Dim color As String
If i Mod 2 = 0 Then color = "palegreen" Else color = "skyblue"
lbl1.Style = "-fx-background-color: " & color & ";"
lbl2.Style = "-fx-background-color: " & color & ";"
tv.Items.Add(Array As Object(WrapLabel(lbl1, "CENTER") , _
WrapLabel(lbl2, "CENTER_RIGHT")))
Next
End Sub
Public Sub ExecuteTableView(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, TableView1 As TableView)
TableView1.Items.Clear
Dim cur As ResultSet
If StringArgs = Null Then
Dim StringArgs(0) As String
End If
cur = SQL.ExecQuery2(Query, StringArgs)
Dim cols As List
cols.Initialize
For i = 0 To cur.ColumnCount - 1
cols.Add(cur.GetColumnName(i))
Next
TableView1.SetColumns(cols)
Do While cur.NextRow
Dim values(cur.ColumnCount) As Label
For col = 0 To cur.ColumnCount - 1
values(col).Initialize("")
values(col).Text = cur.GetString2(col)
Next
TableView1.Items.Add(Array As Object(values(0), WrapLabel(values(1), "CENTER_RIGHT")))
If Limit > 0 AND TableView1.Items.Size >= Limit Then Exit
Loop
cur.Close
End Sub
Sub WrapLabel(lbl As Label, Alignment As String) As Pane
Dim pn1 As AnchorPane
pn1.Initialize("")
pn1.AddNode(lbl, 0, 0, -1, -1)
pn1.FillHorizontally(lbl, 0, 0)
Dim jo1 = lbl As JavaObject
jo1.RunMethod("setAlignment", Array As Object(Alignment))
Return pn1
End Sub
Dim values(cur.ColumnCount) As Pane
For col = 0 To cur.ColumnCount - 1
Dim lbl As Label : lbl.Initialize: lbl.Text = cur.GetString2(col)
values(col) = WrapLabel(lbl, "CENTER_RIGHT")
Next
TableView1.Items.Add(values)
Public Sub ExecuteTableView(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, TableView1 As TableView)
TableView1.Items.Clear
Dim cur As ResultSet
If StringArgs = Null Then
Dim StringArgs(0) As String
End If
cur = SQL.ExecQuery2(Query, StringArgs)
Dim cols As List
cols.Initialize
For i = 0 To cur.ColumnCount - 1
cols.Add(cur.GetColumnName(i))
Next
TableView1.SetColumns(cols)
Do While cur.NextRow
Dim values(cur.ColumnCount) As Pane
For col = 0 To cur.ColumnCount - 1
Dim lbl As Label
lbl.Initialize("")
lbl.Text = cur.GetString2(col)
Log(lbl.Text)
values(col) = WrapLabel(lbl, "CENTER_RIGHT")
Next
TableView1.Items.Add(values)
If Limit > 0 AND TableView1.Items.Size >= Limit Then Exit
Loop
cur.Close
End Sub
Sub WrapLabel(lbl As Label, Alignment As String) As Pane
Dim pn1 As AnchorPane
pn1.Initialize("")
pn1.AddNode(lbl, 0, 0, -1, -1)
pn1.FillHorizontally(lbl, 0, 0)
Dim jo1 = lbl As JavaObject
jo1.RunMethod("setAlignment", Array As Object(Alignment))
Return pn1
End Sub
It doesn't matter. They are the same.I may be completely wrong but shouldn't
Dim jo1 = lbl As JavaObject
be
Dim jo1 As JavaObject = lbl
Dim i1 = 3, i2 = 443, i3 = 23 As Int
Public Sub ExecuteTableView(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, TableView1 As TableView)
TableView1.Items.Clear
Dim cur As ResultSet
If StringArgs = Null Then
Dim StringArgs(0) As String
End If
cur = SQL.ExecQuery2(Query, StringArgs)
Dim cols As List
cols.Initialize
For i = 0 To cur.ColumnCount - 1
cols.Add(cur.GetColumnName(i))
Next
TableView1.SetColumns(cols)
Do While cur.NextRow
Dim values(cur.ColumnCount) As Object
For col = 0 To cur.ColumnCount - 1
Dim lbl As Label
lbl.Initialize("")
lbl.Text = cur.GetString2(col)
If IsNumber(lbl.Text) Then
values(col) = WrapLabel(lbl, "CENTER_RIGHT")
Else
values(col) = WrapLabel(lbl, "CENTER_LEFT")
End If
Next
TableView1.Items.Add(values)
If Limit > 0 AND TableView1.Items.Size >= Limit Then Exit
Loop
cur.Close
End Sub
Sub WrapLabel(lbl As Label, Alignment As String) As Pane
Dim pn1 As AnchorPane
pn1.Initialize("")
pn1.AddNode(lbl, 0, 0, -1, -1)
pn1.FillHorizontally(lbl, 0, 0)
Dim jo1 = lbl As JavaObject
jo1.RunMethod("setAlignment", Array As Object(Alignment))
Return pn1
End Sub
Sub QuoteTV_SelectedRowChanged(Index As Int, Row() As Object)
If Index > -1 Then
Dim lbl1 As Label = Row(0)
QtyText.Text = lbl1.Text
Dim lbl2 As Label = Row(1)
DescText.Text = lbl2.Text
Dim lbl3 As Label = Row(2)
PriceText.Text = lbl3.Text
End If
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?