home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{277255B2-5EBD-11D2-BF5B-00A024982E5B}#10.0#0"; "axTree.ocx"
- Begin VB.Form Form1
- BackColor = &H00C0C0C0&
- Caption = "Form1"
- ClientHeight = 4860
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6510
- LinkTopic = "Form1"
- ScaleHeight = 4860
- ScaleWidth = 6510
- StartUpPosition = 3 'Windows Default
- Begin axTreeControl.axTree axTree1
- Height = 3795
- Left = 315
- TabIndex = 0
- Top = 225
- Width = 3435
- _ExtentX = 6059
- _ExtentY = 6694
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Count = 4
- List_11 = ""
- List_21 = "Level1"
- List_31 = -1
- List_41 = -1 'True
- List_51 = 0
- List_61 = 0
- List_71 = 0
- List_81 = 0
- List_91 = -1
- List_101 = 0
- List_12 = ""
- List_22 = "SubLevel1"
- List_32 = -1
- List_42 = 0 'False
- List_52 = 0
- List_62 = 1
- List_72 = 0
- List_82 = 0
- List_92 = -1
- List_102 = 1
- List_13 = ""
- List_23 = "SubLevel2"
- List_33 = -1
- List_43 = 0 'False
- List_53 = 0
- List_63 = 1
- List_73 = 0
- List_83 = 0
- List_93 = -1
- List_103 = 2
- List_14 = ""
- List_24 = "Level2"
- List_34 = -1
- List_44 = 0 'False
- List_54 = 0
- List_64 = 0
- List_74 = 0
- List_84 = 0
- List_94 = -1
- List_104 = 3
- End
- Begin VB.CommandButton Command1
- Caption = "Show All Selected"
- Height = 420
- Index = 15
- Left = 5265
- TabIndex = 16
- Top = 3105
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "ParentIndex"
- Height = 420
- Index = 14
- Left = 3960
- TabIndex = 15
- Top = 3105
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Add Before"
- Height = 420
- Index = 13
- Left = 3960
- TabIndex = 14
- Top = 1125
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "NewIndex"
- Height = 420
- Index = 10
- Left = 5265
- TabIndex = 13
- Top = 1125
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Expand Node"
- Height = 420
- Index = 12
- Left = 3960
- TabIndex = 12
- Top = 2610
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Collapse Node"
- Height = 420
- Index = 11
- Left = 5265
- TabIndex = 11
- Top = 2610
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Change Node"
- Height = 420
- Index = 9
- Left = 5265
- TabIndex = 10
- Top = 1620
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Add After"
- Height = 420
- Index = 8
- Left = 5265
- TabIndex = 9
- Top = 630
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Find Line"
- Height = 420
- Index = 7
- Left = 5265
- TabIndex = 8
- Top = 3600
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Find Item"
- Height = 420
- Index = 6
- Left = 3960
- TabIndex = 7
- Top = 3600
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Collapse All"
- Height = 420
- Index = 5
- Left = 5265
- TabIndex = 6
- Top = 2115
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Expand All"
- Height = 420
- Index = 4
- Left = 3960
- TabIndex = 5
- Top = 2115
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Add Node"
- Height = 420
- Index = 3
- Left = 3960
- TabIndex = 4
- Top = 630
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Delete Node"
- Height = 420
- Index = 2
- Left = 3960
- TabIndex = 3
- Top = 1620
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Count"
- Height = 420
- Index = 1
- Left = 5265
- TabIndex = 2
- Top = 135
- Width = 1185
- End
- Begin VB.CommandButton Command1
- Caption = "Selected Item"
- Height = 420
- Index = 0
- Left = 3960
- TabIndex = 1
- Top = 135
- Width = 1185
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private db As Database, rs As Recordset
- Private Sub axTree1_Click()
- Debug.Print "click"
- End Sub
- Private Sub axTree1_NodeClick(Index As Integer)
- Debug.Print "nodeclick", Str(Index)
- End Sub
- Private Sub Command1_Click(Index As Integer)
- Dim msItem As String
- Select Case Index
- Case 0
- msg = Str(axTree1.SelectedItem) + vbCr + axTree1.Item(axTree1.SelectedItem) + vbCr + IIf(axTree1.Item(axTree1.SelectedItem).Selected, "Selected", "Not Selected") + vbCr + IIf(axTree1.Item(axTree1.SelectedItem).isparent, "Parent", "Child")
- MsgBox msg, vbOKOnly, "SelectedItem"
- Case 1
- MsgBox axTree1.Count, vbOKOnly, "Count"
- Case 2
- axTree1.RemoveNode axTree1.SelectedItem
- Case 3
- axTree1.AddNode "test" + Str(axTree1.Count + 1), 0, False
- Case 4
- axTree1.ExpandAll
- Case 5
- axTree1.CollapseAll
- Case 6
- msItem = InputBox("Search for item", "Search")
- If msItem > "" Then
- axTree1.Find msItem, 0
- End If
- Case 7
- msItem = InputBox("Search for item", "Search", "0")
- If msItem > "" Then
- axTree1.SelectedItem = Val(msItem)
- End If
- Case 8
- axTree1.AddNode "after" + Str(axTree1.Count + 1), 0, False, , axTree1.SelectedItem
- Case 9
- axTree1.Item(axTree1.SelectedItem).Caption = "Changed"
- axTree1.Item(axTree1.SelectedItem).Selected = 1
- axTree1.Refresh
- Case 10
- MsgBox Str(axTree1.NewIndex)
- Case 11 'collapse node
- msItem = InputBox("Collapse item", "Search", "0")
- If msItem > "" Then
- axTree1.Collapse Val(msItem)
- End If
- Case 12 'expand node
- msItem = InputBox("Expand item", "Search", "0")
- If msItem > "" Then
- axTree1.Expand Val(msItem)
- End If
- Case 13
- axTree1.AddNode "before" + Str(axTree1.Count + 1), 0, False, axTree1.SelectedItem
- Case 14
- MsgBox axTree1.ParentIndex(axTree1.SelectedItem)
- Case 15
- msg = ""
- For cnt = 1 To axTree1.Count
- If axTree1.Item(cnt).Selected > 0 Then
- msg = msg + axTree1.Item(cnt).Caption + ", " + Str(axTree1.Item(cnt).Selected) + vbCr
- End If
- Next
- MsgBox msg
- End Select
- End Sub
- Private Sub Form_Load()
- Dim PrevType As String
- axTree1.Clear
- axTree1.AutoRefresh = False
- 'open the database and create the recordset
- Set db = OpenDatabase(App.Path & "\TestSet.mdb")
- Set rs = db.OpenRecordset("Select * from Address inner join ContactType on Address.ContactType = ContactType.TypeId Order By TypeName, LastName")
- PrevType = ""
- rs.MoveFirst
- Do Until rs.EOF
- If PrevType <> rs("TypeName") Then
- axTree1.AddNode rs("TypeName"), 0, True
- PrevType = rs("TypeName")
- End If
- axTree1.AddNode rs("LastName"), 1, False
- rs.MoveNext
- Loop
- axTree1.Item(axTree1.Count).bitmap = LoadPicture(App.Path + "\bitmaps\hlp.bmp")
- ' axTree1.AddNode "level0", 0, False, , , , , LoadPicture(App.Path + "/bitmaps/hlp.bmp")
- ' axTree1.AddNode "level1", 1, True
- ' axTree1.AddNode "level2", 2, True
- ' axTree1.AddNode "level3", 3, True
- ' axTree1.AddNode "level4", 4, True
- ' axTree1.AddNode "level5", 5, True
- ' axTree1.AddNode "level6", 6, True
- ' axTree1.AddNode "level7", 7, False
- axTree1.AutoRefresh = True
- axTree1.CollapseAll
- 'axTree1.Refresh
- Set rs = Nothing
- Set db = Nothing
- End Sub
-