home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{DB625B91-05EA-11D2-97DD-00400520799C}#3.0#0"; "PVTREEX.OCX"
- Begin VB.Form Main
- BorderStyle = 3 'Fixed Dialog
- Caption = "TreeViewX Sample"
- ClientHeight = 5430
- ClientLeft = 2055
- ClientTop = 1380
- ClientWidth = 7260
- Icon = "Main.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 5430
- ScaleMode = 0 'User
- ScaleWidth = 7077.74
- ShowInTaskbar = 0 'False
- Begin PVTreeView3Lib.PVTreeViewX PVTreeViewX1
- Height = 4095
- Left = 120
- TabIndex = 7
- Top = 960
- Width = 4335
- _Version = 196608
- _ExtentX = 7646
- _ExtentY = 7223
- _StockProps = 237
- Appearance = 1
- DataMember = ""
- DataField0 = ""
- DataField1 = ""
- DataField2 = ""
- DataField3 = ""
- DataField4 = ""
- DataField5 = ""
- DataField6 = ""
- DataField7 = ""
- DataField8 = ""
- DataField9 = ""
- DataField10 = ""
- DataField11 = ""
- DataField12 = ""
- DataField13 = ""
- DataField14 = ""
- DataField15 = ""
- DataField16 = ""
- DataField17 = ""
- DataField18 = ""
- DataField19 = ""
- End
- Begin VB.CommandButton ChangeText
- Caption = "Change Selected Node's Text"
- Height = 495
- Left = 4680
- TabIndex = 5
- Top = 4560
- Width = 2295
- End
- Begin VB.CommandButton AddRootNode
- Caption = "Add Root Node"
- Height = 495
- Left = 4680
- TabIndex = 4
- Top = 3840
- Width = 2295
- End
- Begin VB.CommandButton InsertNewNode
- Caption = "Insert New Node"
- Height = 495
- Left = 4680
- TabIndex = 3
- Top = 3120
- Width = 2295
- End
- Begin VB.CommandButton DeleteCurrentNode
- Caption = "Delete Current Node"
- Height = 495
- Left = 4680
- TabIndex = 2
- Top = 2400
- Width = 2295
- End
- Begin VB.CommandButton SelectNextNode
- Caption = "Select Next Node"
- Height = 495
- Left = 4680
- TabIndex = 1
- Top = 1680
- Width = 2295
- End
- Begin VB.CommandButton SelectPreviousNode
- Caption = "Select Previous Node"
- Height = 495
- Left = 4680
- TabIndex = 0
- Top = 960
- Width = 2295
- End
- Begin VB.Label Label1
- Caption = $"Main.frx":030A
- Height = 495
- Left = 120
- TabIndex = 6
- Top = 120
- Width = 6855
- End
- Attribute VB_Name = "Main"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub AddRootNode_Click()
- Dim root As PVBranch
- Dim NewNode As PVBranch
- Set root = PVTreeViewX1.Branches
- Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- NewNode.Select pvtSelectNode
- Dim ret As String
- ret = InputBox("Enter text for item", "Caption", NewNode.Text)
- If (ret <> "") Then
- NewNode.Text = ret
- End If
- End Sub
- Private Sub Command6_Click()
- End Sub
- Private Sub ChangeText_Click()
- Dim ret As String
- Dim selnode As PVBranch
- Set selnode = PVTreeViewX1.Branches.Get(pvtGetNextSelected, 0)
- If (selnode Is Nothing) Then Exit Sub
- If (selnode.IsValid = False) Then Exit Sub
- ret = InputBox("Enter text for item", "Caption", selnode.Text)
- If (ret <> "") Then
- selnode.Text = ret
- End If
- End Sub
- Private Sub DeleteCurrentNode_Click()
- Dim root As PVBranch
- Dim node As PVBranch
- Dim NextNode As PVBranch
- Set root = PVTreeViewX1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid) Then
- NextNode.Remove
- End If
- End If
- End Sub
- Private Sub Form_Load()
- Dim root As PVBranch
- Dim ParentNode As PVBranch
- Dim ChildNode As PVBranch
- PVTreeViewX1.AutoOpen = True
- PVTreeViewX1.AlwaysShowSelection = True
- Set root = PVTreeViewX1.Branches
- Set ParentNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
- Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
- Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
- ParentNode.Select pvtSelectNode
- Set ParentNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- Set ChildNode = ParentNode.Add(pvtPositionAfter, 0, "Child Node")
- End Sub
- Private Sub InsertNewNode_Click()
- Dim root As PVBranch
- Dim node As PVBranch
- Dim NextNode As PVBranch
- Dim NewNode As PVBranch
- Set root = PVTreeViewX1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid) Then
- Set NewNode = NextNode.Add(pvtPositionInOrder, 0, "New Node")
- NewNode.Select pvtSelectNode
- Else
- Set NewNode = node.Add(pvtPositionInOrder, 0, "Child Node")
- NewNode.Select pvtSelectNode
- End If
- Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- NewNode.Select pvtSelectNode
- End If
- Dim ret As String
- ret = InputBox("Enter text for item", "Caption", NewNode.Text)
- If (ret <> "") Then
- NewNode.Text = ret
- End If
- End Sub
- Private Sub PVTreeViewX1_KeyDown(KeyCode As Integer, Shift As Integer)
- If (KeyCode = vbKeyLeft Or KeyCode = vbKeyDelete) Then
- DeleteCurrentNode_Click
- End If
- If (KeyCode = vbKeyRight Or KeyCode = vbKeyInsert) Then
- InsertNewNode_Click
- End If
- If (KeyCode = vbKeyReturn) Then
- Set root = PVTreeViewX1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid) Then
- PVTreeViewX1.BeginInPlaceEdit
- End If
- End If
- End If
- End Sub
- Private Sub SelectNextNode_Click()
- Dim root As PVBranch
- Dim node As PVBranch
- Dim NextNode As PVBranch
- Set root = PVTreeViewX1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid = True) Then
- Rem get the next item in the tree
- Set node = NextNode.Get(pvtGetNextVisible, 0)
- If (node.IsValid = True) Then
- node.Select pvtSelectNode
- Else
- Rem we are at the last item in the tree
- End If
- Else
- Rem select the first item in the tree
- node.Select pvtSelectNode
- End If
- Rem no items in tree, do nothing
- End If
- End Sub
- Private Sub SelectPreviousNode_Click()
- Dim root As PVBranch
- Dim node As PVBranch
- Dim NextNode As PVBranch
- Set root = PVTreeViewX1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid) Then
- Rem get the previous item in the tree
- Set node = NextNode.Get(pvtGetPrevVisible, 0)
- If (node.IsValid = True) Then
- node.Select pvtSelectNode
- Else
- Rem we are at the first item in the tree
- End If
- Else
- Rem select the first item in the tree
- node.Select pvtSelectNode
- End If
- Rem no items in tree, do nothing
- End If
- End Sub
-