vbAccelerator - Contents of code file: frmXmlTreeView.frm

VERSION 5.00
Object = "{A3A35BDB-3B6A-46F3-B662-08B8F72ECD03}#11.1#0"; "vbalTreeView.ocx"
Begin VB.Form frmXmlTreeView 
   Caption         =   "vbAccelerator TreeView/XML Demonstration"
   ClientHeight    =   8430
   ClientLeft      =   2640
   ClientTop       =   2745
   ClientWidth     =   6585
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmXmlTreeView.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   8430
   ScaleWidth      =   6585
   Begin VB.TextBox txtItem 
      Height          =   1155
      Left            =   60
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   6
      Top             =   7200
      Width           =   6435
   End
   Begin VB.CommandButton cmdLoad 
      Caption         =   "&Load"
      Height          =   315
      Left            =   5820
      TabIndex        =   5
      Top             =   60
      Width           =   675
   End
   Begin VB.TextBox txtXpath 
      Height          =   315
      Left            =   900
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   420
      Width           =   5595
   End
   Begin VB.TextBox txtFilename 
      Height          =   315
      Left            =   900
      TabIndex        =   1
      Text            =   $"frmXmlTreeView.frx":1272
      Top             =   60
      Width           =   4875
   End
   Begin vbalTreeViewLib.vbalTreeView tvwXml 
      Height          =   6315
      Left            =   60
      TabIndex        =   0
      Top             =   780
      Width           =   6435
      _ExtentX        =   11351
      _ExtentY        =   11139
      NoCustomDraw    =   0   'False
      OLEDropMode     =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label lblXPath 
      Caption         =   "&XPath"
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   420
      Width           =   675
   End
   Begin VB.Label lblFilename 
      Caption         =   "&File"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   675
   End
End
Attribute VB_Name = "frmXmlTreeView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_c As New cXmlTreeView


Private Sub pLoad()
   m_c.Filename = txtFilename.Text
   m_c.Load
   Set tvwXml.Font = Me.Font
End Sub

Private Sub cmdLoad_Click()
   pLoad
End Sub

Private Sub Form_Load()
   m_c.TreeView = tvwXml
   txtFilename.Text = App.Path & "/home/VB/Code/Controls/TreeView/XML_TreeView/article.xml"
   pLoad
End Sub

Private Sub Form_Resize()
Dim lHeight As Long
   On Error Resume Next
   lHeight = Me.ScaleHeight - tvwXml.Top - txtItem.Height - 4 *
    Screen.TwipsPerPixelY
   tvwXml.Move tvwXml.Left, tvwXml.Top, Me.ScaleWidth - tvwXml.Left * 2, lHeight
   txtItem.Move tvwXml.Left, tvwXml.Top + lHeight + 2 * Screen.TwipsPerPixelY,
    Me.ScaleWidth - tvwXml.Left * 2
   txtFilename.Width = Me.ScaleWidth - txtFilename.Left - 4 *
    Screen.TwipsPerPixelX - cmdLoad.Width
   cmdLoad.Left = txtFilename.Left + txtFilename.Width + 2 *
    Screen.TwipsPerPixelX
   txtXpath.Width = Me.ScaleWidth - txtFilename.Left - 2 * Screen.TwipsPerPixelX
End Sub

Private Sub tvwXml_BeforeExpand(node As vbalTreeViewLib.cTreeViewNode, cancel
 As Boolean)
   m_c.NodeExpand node
End Sub


Private Sub tvwXml_SelectedNodeChanged()
   txtXpath.Text = tvwXml.SelectedItem.Key
   txtItem.Text = m_c.GetItemText(tvwXml.SelectedItem)
End Sub