has anyone of you ever used a TreeView ActiveX object in a MM script?
I'ven been trying to display a hierarchical tree on a simple form. The problem however is that the items don't show up as nested nodes as intended. All I got was a flat list.
Is it possible at all to use such an object within MM? Help is very much appreciated.
Here is the sample code I used:
Code: Select all
Dim nodX
Sub OnStartup
Set Mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_Scripts, 0, 0)
Mnu.Caption = "Open Form..."
Mnu.UseScript = Script.ScriptPath
Mnu.OnClickFunc = "ShowIt"
End Sub
Sub ShowIt( Itm)
Set UI = SDB.UI
' Create the window to be shown
Set Form = UI.NewForm
Form.Common.SetRect 100, 100, 500, 400
Form.Caption = "MyForm"
Form.StayOnTop = True
Set tvcExample = UI.NewActiveX (Form, "COMCTL.TreeCtrl")
' Set Treeview control properties.
tvcExample.Common.Width = 200
tvcExample.Common.Height = 400
tvcExample.Interf.LineStyle = tvwRootLines ' Linestyle 1
' Add Node objects
' First node with 'Root1' as text.
Set nodX = tvcExample.Interf.Nodes.Add(, , "r1", "Root1")
' Second node on root with 'Root2' as text
Set nodX = tvcExample.Interf.Nodes.Add(, , "r2", "Root2")
' This next node is a child of Node 1 ("Root").
Set nodX = tvcExample.Interf.Nodes.Add("r1", tvwChild, "child1", "Child")
Form.Common.Visible = True
SDB.Objects("Sample Form") = Form
End Sub
mattisse