Sub Class_Globals
#Region SplitPane Scroll-bar
Type MySplitPane (MinValue As Double, MaxValue As Double, SetValue1 As Double, SetValue2 As Double, SetValue3 As Double, _
BBCodeView(7) As Double, taSourceCode(7) As Double, taNote(7) As Double, ScroolBar_Visible As Boolean)
Public ssp As MySplitPane
#End Region
End Sub
'GlobalVariable = {1=BBCodeView1.mBase, 2=taSourceCode, 3=taNote}
'1=BBCodeView1.mBase As BBCodeView
'2=taSourceCode As B4XView
'3=taNote As B4Xview
'ssp.ScroolBar_Visible - True, if a vertical scroll-bar is visible
'EventName_ScrollPosition_Changed - Saves the scroll-bar position for the current object (see: GlobalVariable)
Private Sub SetScrollPositionsEvent(GlobalVariable As Int)
Dim jo As JavaObject = IIf(GlobalVariable = 1, BBCodeView1.mBase, IIf(GlobalVariable = 2, taSourceCode, taNote))
Dim bars() As Object = jo.RunMethodJO("lookupAll",Array(".scroll-bar")).RunMethod("toArray",Null)
Dim SplitPaneScrollBar As JavaObject
ssp.ScroolBar_Visible = False
For Each sps As Object In bars
Dim sbJO As JavaObject
sbJO = sps
Dim SnippetBarOrientation1 As String = sbJO.RunMethod("getOrientation",Null)
If SnippetBarOrientation1 = "VERTICAL" Then
ssp.ScroolBar_Visible = sps.As(Node).Visible
SplitPaneScrollBar = sbJO
End If
Next
If SplitPaneScrollBar.IsInitialized And ssp.ScroolBar_Visible = True Then
Dim position As Double
Dim mSnippet As Int = modDBProject.ModuleNote
ssp.MinValue = SplitPaneScrollBar.RunMethod("getMin", Null) 'ignore
ssp.MaxValue = SplitPaneScrollBar.RunMethod("getMax", Null) 'ignore
If mEditing = True Then
If isFocused.taSourceCode Then
position = ssp.taSourceCode(mSnippet)
Else If isFocused.taNote Then
position = ssp.taNote(mSnippet)
End If
Else
position = ssp.BBCodeView(mSnippet)
End If
SplitPaneScrollBar.RunMethod("setValue", Array(position))
Dim EventName As String = IIf(GlobalVariable = 1, "BBCodeView", IIf(GlobalVariable = 2, "SourceCode", "Note"))
Dim ref As Reflector
ref.Target = SplitPaneScrollBar
ref.AddChangeListener(EventName&"_ScrollPosition","valueProperty")
End If
End Sub
Private Sub BBCodeView_ScrollPosition_Changed(OldVal As Object,NewVal As Object)
If mEditing = False Then
ssp.BBCodeView(modDBProject.ModuleNote) = NewVal.As(Double)
End If
End Sub
Private Sub SourceCode_ScrollPosition_Changed(OldVal As Object,NewVal As Object)
If mEditing = True Then
If isFocused.taSourceCode Then
ssp.taSourceCode(modDBProject.ModuleNote) = NewVal.As(Double)
Else If isFocused.taNote Then
ssp.taNote(modDBProject.ModuleNote) = NewVal.As(Double)
End If
End If
End Sub
Private Sub Note_ScrollPosition_Changed(OldVal As Object,NewVal As Object)
If mEditing = True Then
If isFocused.taSourceCode Then
ssp.taSourceCode(modDBProject.ModuleNote) = NewVal.As(Double)
Else If isFocused.taNote Then
ssp.taNote(modDBProject.ModuleNote) = NewVal.As(Double)
End If
End If
End Sub