home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form UDLRFrm
- Caption = "TreeView"
- ClientHeight = 5760
- ClientLeft = 2070
- ClientTop = 1395
- ClientWidth = 6990
- Height = 6165
- Left = 2010
- LinkTopic = "Form1"
- ScaleHeight = 5760
- ScaleWidth = 6990
- Top = 1050
- Width = 7110
- Begin PVButtonLib.PVButton Command1
- Height = 495
- Left = 0
- TabIndex = 8
- Top = 840
- Width = 495
- _Version = 65541
- _ExtentX = 873
- _ExtentY = 873
- _StockProps = 70
- Picture = 5
- Caption = ""
- CustomPicture = "UDLRFrm.frx":0000
- End
- Begin VB.Label Label6
- Caption = "Click the '+' button to insert a new top level node"
- Height = 255
- Left = 600
- TabIndex = 7
- Top = 1320
- Width = 6135
- End
- Begin VB.Label Label5
- Caption = "Double-click an item or hit the Return key to change its text"
- Height = 255
- Left = 600
- TabIndex = 6
- Top = 1080
- Width = 6135
- End
- Begin VB.Label Label4
- Caption = "Use the Right arrow or Insert key to insert a new item as the child of the current item"
- Height = 255
- Left = 600
- TabIndex = 5
- Top = 840
- Width = 6135
- End
- Begin VB.Label Label3
- Caption = "Use the Left arrow or Delete key to delete the current item and all its chilldren"
- Height = 255
- Left = 600
- TabIndex = 4
- Top = 600
- Width = 6135
- End
- Begin VB.Label Label2
- Caption = "Use the Down arrow to change selection to the next item"
- Height = 255
- Left = 600
- TabIndex = 3
- Top = 360
- Width = 6135
- End
- Begin VB.Label Label1
- Caption = "Use the Up arrow to change selection to the previous item."
- Height = 255
- Left = 600
- TabIndex = 2
- Top = 120
- Width = 6135
- End
- Begin PVTreeViewLib.PVTreeView PTreeView1
- Height = 3780
- Left = 120
- TabIndex = 1
- Top = 1800
- Width = 6015
- _Version = 65541
- _ExtentX = 10610
- _ExtentY = 6668
- _StockProps = 228
- Appearance = 1
- Sort = 0 'False
- AlwaysShowSelection= -1 'True
- End
- Begin PVMultiBtnLib.PVMultiBtn Multibtn1
- Height = 435
- Left = 0
- TabIndex = 0
- Top = 120
- Width = 435
- _Version = 65541
- _ExtentX = 767
- _ExtentY = 767
- _StockProps = 224
- End
- Attribute VB_Name = "UDLRFrm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- Set root = PTreeView1.Branches
- Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- NewNode.Select pvtNode
- 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 Form_Load()
- Dim root As Branch
- Dim ParentNode As Branch
- Dim ChildNode As Branch
- PTreeView1.AutoOpen = True
- PTreeView1.EnableLines = True
- PTreeView1.EnableMicroBitmaps = True
- PTreeView1.EnableBitmaps = True
- Set root = PTreeView1.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 1
- Set ParentNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- Set ChildNode = ParentNode.Add(pvtPositionAfter, 0, "Child Node")
- End Sub
- Private Sub Multibtn1_Down()
- Dim root As Branch
- Dim node As Branch
- Dim NextNode As Branch
- Set root = PTreeView1.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 pvtNode
- Else
- Rem we are at the last item in the tree
- End If
- Else
- Rem select the first item in the tree
- node.Select pvtNode
- End If
- Rem no items in tree, do nothing
- End If
- End Sub
- Private Sub Multibtn1_Left()
- Dim root As Branch
- Dim node As Branch
- Dim NextNode As Branch
- Set root = PTreeView1.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 Multibtn1_Right()
- Dim root As Branch
- Dim node As Branch
- Dim NextNode As Branch
- Dim NewNode As Branch
- Set root = PTreeView1.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 pvtNode
- Else
- Set NewNode = node.Add(pvtPositionInOrder, 0, "Child Node")
- NewNode.Select pvtNode
- End If
- Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
- NewNode.Select pvtNode
- 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 Multibtn1_Up()
- Dim root As Branch
- Dim node As Branch
- Dim NextNode As Branch
- Set root = PTreeView1.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 pvtNode
- Else
- Rem we are at the first item in the tree
- End If
- Else
- Rem select the first item in the tree
- node.Select pvtNode
- End If
- Rem no items in tree, do nothing
- End If
- End Sub
- Private Sub PTreeView1_KeyDown(KeyCode As Integer, Shift As Integer)
- If (KeyCode = vbKeyLeft Or KeyCode = vbKeyDelete) Then
- Multibtn1_Left
- End If
- If (KeyCode = vbKeyRight Or KeyCode = vbKeyInsert) Then
- Multibtn1_Right
- End If
- If (KeyCode = vbKeyReturn) Then
- Set root = PTreeView1.Branches
- Set node = root.Get(pvtGetChild, 0)
- If (node.IsValid) Then
- Set NextNode = node.Get(pvtGetNextSelected, 0)
- If (NextNode.IsValid) Then
- PTreeView1.BeginInPlaceEdit
- ' ret = InputBox("Enter text for item", "Caption", NextNode.Text)
- ' If (ret <> "") Then
- ' NextNode.Text = ret
- ' End If
- End If
- End If
- End If
- End Sub
- Private Sub PTreeView1_LButtonDblClick(ByVal node As Branch, ByVal x As Single, ByVal y As Single)
- Dim ret As String
- If (node Is Nothing = False) Then
- PTreeView1.BeginInPlaceEdit
- ' ret = InputBox("Enter text for item", "Caption", node.Text)
- ' If (ret <> "") Then
- ' node.Text = ret
- ' End If
- End If
- End Sub
- Private Sub Select_Click()
- If (SelectBox.Value) Then
- PTreeView1.SelectMode = 2
- PTreeView1.SelectMode = 0
- End If
- End Sub
- Private Sub SelectBox_Click()
- If (SelectBox.Value = 1) Then
- PTreeView1.SelectMode = 2
- PTreeView1.SelectMode = 0
- End If
- End Sub
-