by Eyal » Sun Oct 16, 2011 10:23 pm
Hi Thanasis,
I never used this control, but as I understand it, VTGetText() is only executed on first initialization of the
SDBUITreeList control, and when
Refresh method is used.
Thus I thing the easiest would be to initially fill the data to display in an array, and call the Refresh method on subsequent changes.
Example:
- Code: Select all
Dim lbl, VT, GridData(10,3)
Sub OnStartUp()
Dim Form
Set Form = SDB.UI.NewForm
Form.Common.SetRect 100, 100, 500, 440
Form.BorderStyle = 3
Form.FormPosition = 4
Form.StayOnTop = True
Form.Caption = "Test"
Set lbl = SDB.UI.NewLabel(Form)
lbl.Common.SetRect 10, 10, 400, 15
Set VT = SDB.UI.NewTreeList(Form)
VT.Common.SetRect 10, 30, 400, 300
VT.HeaderVisible = true
VT.HeaderAddColumn "Title"
VT.HeaderAddColumn "Column 2"
VT.HeaderAddColumn "Column 3"
VT.HeaderColumnWidth(0) = 150
VT.HeaderColumnWidth(1) = 120
VT.HeaderColumnWidth(2) = 120
VT.RootNodeCount = 10
VT.ShowTreeLines = False
VT.Indent = 0
VT.FullRowSelect = True
VT.ExtendedFocus = true
VT.MultiSelect = true
VT.GridExtensions = true
VT.ShowRoot = false
'------------------------
'Fill Grid data:
GridData(0,0) = "text 1"
GridData(0,1) = "text 2"
GridData(1,2) = "text 3"
GridData(4,1) = "text 4"
GridData(7,0) = "100"
GridData(9,2) = "2000"
'------------------------
Script.RegisterEvent VT, "OnFocusChanged", "VTFocusChanged"
Script.RegisterEvent VT, "OnGetText", "VTGetText"
Form.Common.Visible = True
SDB.Objects("Form") = Form
End Sub
Sub VTFocusChanged( Node, Column)
lbl.Caption = Node.Index & " - " & Column
End Sub
Function VTGetText(Node, Column)
If IsEmpty(GridData(Node.index, Column)) Then
VTGetText = ""
Else
VTGetText = GridData(Node.index, Column)
End If
End Function
:~)
Hi Thanasis,
I never used this control, but as I understand it, VTGetText() is only executed on first initialization of the [color=#0000FF][url=http://www.mediamonkey.com/wiki/index.php/SDBUITreeList]SDBUITreeList[/url][/color] control, and when [color=#0000FF]Refresh[/color] method is used.
Thus I thing the easiest would be to initially fill the data to display in an array, and call the Refresh method on subsequent changes.
Example:
[code]Dim lbl, VT, GridData(10,3)
Sub OnStartUp()
Dim Form
Set Form = SDB.UI.NewForm
Form.Common.SetRect 100, 100, 500, 440
Form.BorderStyle = 3
Form.FormPosition = 4
Form.StayOnTop = True
Form.Caption = "Test"
Set lbl = SDB.UI.NewLabel(Form)
lbl.Common.SetRect 10, 10, 400, 15
Set VT = SDB.UI.NewTreeList(Form)
VT.Common.SetRect 10, 30, 400, 300
VT.HeaderVisible = true
VT.HeaderAddColumn "Title"
VT.HeaderAddColumn "Column 2"
VT.HeaderAddColumn "Column 3"
VT.HeaderColumnWidth(0) = 150
VT.HeaderColumnWidth(1) = 120
VT.HeaderColumnWidth(2) = 120
VT.RootNodeCount = 10
VT.ShowTreeLines = False
VT.Indent = 0
VT.FullRowSelect = True
VT.ExtendedFocus = true
VT.MultiSelect = true
VT.GridExtensions = true
VT.ShowRoot = false
'------------------------
'Fill Grid data:
GridData(0,0) = "text 1"
GridData(0,1) = "text 2"
GridData(1,2) = "text 3"
GridData(4,1) = "text 4"
GridData(7,0) = "100"
GridData(9,2) = "2000"
'------------------------
Script.RegisterEvent VT, "OnFocusChanged", "VTFocusChanged"
Script.RegisterEvent VT, "OnGetText", "VTGetText"
Form.Common.Visible = True
SDB.Objects("Form") = Form
End Sub
Sub VTFocusChanged( Node, Column)
lbl.Caption = Node.Index & " - " & Column
End Sub
Function VTGetText(Node, Column)
If IsEmpty(GridData(Node.index, Column)) Then
VTGetText = ""
Else
VTGetText = GridData(Node.index, Column)
End If
End Function[/code]
:~)