### SplitPane Set position Divider

To set the position of the SplitPane divider make use of JavaObjects.
(requires the JavaObjects library)
Reference: http://docs.oracle.com/javafx/2/api/javafx/scene/control/SplitPane.html
Example Subs to set and get the divider position
'
' SECTION: SPLITPANE DIVIDER
' See http://docs.oracle.com/javafx/2/api/javafx/scene/control/SplitPane.html#getDividerPositions()
'
' Sets the position of the divider for a splitpane
' Parameter SplitPane: The SplitPane
' Parameter Index: The index of the Divider. Starting with 0
' Parameter Position: The position of the divider to be between range 0 to 1
`Sub setDividerPosition(Split As Node, DividerIndex As Int, Position As Double)
Dim jo As JavaObject = Split
jo.RunMethod("setDividerPosition", Array As Object(DividerIndex, Position))
' Log("setDividerPosition: Index: " & DividerIndex & ", Position: " & Position)
End Sub`
' Gets the position of the divider for a splitpane
' Parameter Split: The SplitPane
' Parameter Index: Index of the Divider
' Return: Position of the Divider range 0 to 1
`Sub getDividerPosition(Split As Node, DividerIndex As Int) As Double
Dim jo As JavaObject = Split
Dim dp() As Double
dp = jo.RunMethod("getDividerPositions", Null)
If (DividerIndex < 0) OR (DividerIndex > dp.Length) Then Return -1
' Log("getDividerPosition: Index: " & DividerIndex & ", Position: " & dp(DividerIndex))
Return dp(DividerIndex)
End Sub`
Example usage
...
MainForm = Form1
MainForm.RootPane.LoadLayout("mainformlayout")
MainForm.Icon = fx.LoadImage(File.DirAssets, "mainformicon.png")
' Set the divider position - note: this must be set prior form show
setDividerPosition(spMain, 0, 0.5)
'
MainForm.Show
...

Changed: , Category: Panes, File: T6C230M1694.htm, ID: 1694