This sample illustrates saving the tree control's contents to an XML file and loading them back, using both flat and nested (hierarchical) XML formats.
The source code is located at C:\Program Files (x86)\Softelvdm\SftTree OCX 8.0\Samples\VB6\XMLLoadSave\Form1.frm or C:\Program Files\Softelvdm\SftTree OCX 8.0\Samples\VB6\XMLLoadSave\Form1.frm (on 32-bit Windows versions).
VERSION 5.00
Object = "{04048830-2BE4-4868-8CDC-B8E6FC7815C5}#8.0#0"; "SftTree_IX86_U_80.ocx"
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 6000
ClientLeft = 45
ClientTop = 435
ClientWidth = 6435
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6000
ScaleWidth = 6435
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin SftTreeLib80.SftTree SftTree1
Height = 5055
Left = 120
TabIndex = 0
Top = 840
Width = 4935
PropVer = 80
xcx = 8705
xcy = 8916
PropFile = ""
PropDesignTime = 1
DeletePropFile = 0
IntVal = 55
xBfStyle1 = 64744843
xBfStyle2 = 763053103
xBfStyle3 = 715085492
xBfStyle4 = -983520932
FlatProperties = 0
Appearance = 1
AutoRespond = 1
BackgroundStyle = 0
BackgroundX = 0
BackgroundY = 0
BorderStyle = 0
ButtonStyle = 2
CellEventHandling= 0
CellEditStyle = 0
CellEditLimit = 0
ColumnCount = 3
CopyItemDataString= 1
CustomCode = 0
DragImage = 0
DragMethod = 1
DragType = 3
Enabled = 1
HandleReturn = 1
MousePointer = 0
LeftButtonOnly = 1
LeftItemClickOnly= 1
OLEDropMode = 0
RightToLeft = 0
UseThemes = -1 'True
Scrollbars = 3
ScrollbarStyle = 0
ShowTruncated = 1
VAlignStyle = 0
VirtualMode = 0
WebLicense = ""
SmoothScroll = 1
ButtonAppearance= 8
MouseOverTransitionEffect= 0
EdgeVerticalColor= -1
EdgeHorizontalColor= -1
DarkMode = 0
HighContrastMode= 0
SizeBox = 0
ImageScaling = 0
PixelScaling = 0
BeginProperty ItemEditFont {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
BeginProperty Columns {0404883E-2BE4-4868-8CDC-B8E6FC7815C5}
InheritBgColor = 1
OpenEnded = 1
OpenEnded2 = 1
EndProperty
BeginProperty Headers {04048836-2BE4-4868-8CDC-B8E6FC7815C5}
Appearance = 1
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
Multiline = 1
ShadowColor = -2147483632
Reorderable = 1
Resizable = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
SortIndicators = 0
EndProperty
BeginProperty Footers {04048856-2BE4-4868-8CDC-B8E6FC7815C5}
Appearance = 0
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
Multiline = 1
ShadowColor = -2147483632
Reorderable = 1
Resizable = 1
EndProperty
BeginProperty Items {0404883C-2BE4-4868-8CDC-B8E6FC7815C5}
AutoExpandDragDrop= 1
AutoExpandHover = 0
BackColor = -2147483643
BackColorOdd = -2147483643
CalcLimit = 0
CalcVisibleOnly = 0
Cell3D = 0
CharSearchColumn= -1
CharSearchMode = 1
DropHighlightColor= -2147483635
DropHighlightStyle= 1
EditNoFocusStyle= 2
FlybyHighlight = 1
ForeColor = -2147483640
ForeColorOdd = -2147483640
GrayedColor = -2147483631
GridHorizontalColor= -1
GridStyle = 0
GridVerticalColor= -1
HilightColor = -2147483628
HorizontalExtentPix= 0
HorizontalExtent2Pix= 0
HorizontalOffsetPix= 0
HorizontalOffset2Pix= 0
Indentation = -1
ItemImageAlign = 1
Lines = 1
MaxHeightPix = 0
MinHeightPix = 0
MultiSelect = 0
NoFocusStyle = 0
NoSelection = 0
RubberbandSelection= 1
SelectBackColor = -2147483635
SelectBackColorNoFocus= -2147483633
SelectForeColor = -2147483634
SelectForeColorNoFocus= -2147483630
ShadowColor = -2147483632
Style = 0
ScrollTips = 1
SelectionArea = 1
SelectStyle = 2
ShowFocusRectangle= 1
ToolTipAlways = 0
ToolTipBackColor= -1
ToolTipForeColor= -1
ToolTipsUseEntireCell= 0
TopIndex = 0
TreeLineColor = -2147483631
TreeLineGrayedColor= -2147483631
TreeLineStyle = 2
UpdateCurrentExpandCollapse= 0
OutlineStyle = 0
SelectOutlineBorderColor= -1
SelectInnerBorderColor= -1
SelectInnerFill1= -1
SelectInnerFill2= -1
SelectHotOutlineBorderColor= -1
SelectHotInnerBorderColor= -1
SelectHotInnerFill1= -1
SelectHotInnerFill2= -1
SelectNoFocusOutlineBorderColor= -1
SelectNoFocusInnerBorderColor= -1
SelectNoFocusInnerFill1= -1
SelectNoFocusInnerFill2= -1
HotOutlineBorderColor= -1
HotInnerBorderColor= -1
HotInnerFill1 = -1
HotInnerFill2 = -1
DropTargetOutlineBorderColor= -1
DropTargetInnerBorderColor= -1
DropTargetInnerFill1= -1
DropTargetInnerFill2= -1
DisabledItemsSelectable= 1
AutoExpandDragDropInterval= 1200
AutoExpandHoverInterval= 1200
ToolTipIntervalOn= 200
ToolTipIntervalOff= 100
EndProperty
BeginProperty RowColumnHeader {04048842-2BE4-4868-8CDC-B8E6FC7815C5}
Appearance = 1
ButtonDown = 0
RemainUp = 1
Enabled = 1
ImageHAlign = 0
ImageVAlign = 0
TextHAlign = 0
TextVAlign = 0
Text = ""
ForeColor = -2147483630
BackColor = -2147483633
HilightColor = -2147483628
ShadowColor = -2147483632
GrayedColor = -2147483631
OverrideTheme = 0
EndProperty
BeginProperty RowColumnFooter {0404885A-2BE4-4868-8CDC-B8E6FC7815C5}
Appearance = 1
ButtonDown = 0
RemainUp = 1
Enabled = 1
ImageHAlign = 0
ImageVAlign = 0
TextHAlign = 0
TextVAlign = 0
Text = ""
ForeColor = -2147483630
BackColor = -2147483633
HilightColor = -2147483628
ShadowColor = -2147483632
GrayedColor = -2147483631
OverrideTheme = 0
EndProperty
BeginProperty RowHeaders {04048844-2BE4-4868-8CDC-B8E6FC7815C5}
Appearance = 3
RemainUp = 1
Enabled = 1
Lines = 1
TextHAlign = 0
TextVAlign = 0
Object.Width = 40
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
ShadowColor = -2147483632
SelectBackColor = -2147483633
SelectForeColor = -2147483630
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EndProperty
BeginProperty Splitter {0404884A-2BE4-4868-8CDC-B8E6FC7815C5}
SplitColumn = 0
Object.Visible = 0
OffsetPix = 0
WidthPix = 7
OffsetMinPix = 0
EndProperty
BeginProperty Column(0) {04048838-2BE4-4868-8CDC-B8E6FC7815C5}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 0
DispPos = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(0) {0404883A-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = "Title1"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(0) {04048858-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Column(1) {04048838-2BE4-4868-8CDC-B8E6FC7815C5}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 1
DispPos = 1
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(1) {0404883A-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = "Title2"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(1) {04048858-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Column(2) {04048838-2BE4-4868-8CDC-B8E6FC7815C5}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 2
DispPos = 2
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(2) {0404883A-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = "Title3"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(2) {04048858-2BE4-4868-8CDC-B8E6FC7815C5}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
SavedItemCount = 6
SavedColumnCount= 3
BeginProperty Item(0) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 0
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = -1 'True
Expandable = -1 'True
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Item(1) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 1
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = 0 'False
Expandable = 0 'False
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Item(2) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 0
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = -1 'True
Expandable = -1 'True
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Item(3) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 1
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = -1 'True
Expandable = -1 'True
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Item(4) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 2
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = 0 'False
Expandable = 0 'False
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Item(5) {04048840-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataFloat = 0
DataString = ""
EditIgnore = 0 'False
Enabled = -1 'True
HideExpandCollapseButton= 0 'False
Ignore = 0 'False
Level = 0
MaxHeightPix = 0
MinHeightPix = 0
Selected = 0 'False
Expanded = 0 'False
Expandable = 0 'False
BeginProperty RowHeader {04048848-2BE4-4868-8CDC-B8E6FC7815C5}
Text = ""
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
OverrideTheme = 0 'False
EndProperty
BeginProperty Cell(0) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "New Item, Cell 0"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(1) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 1"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
BeginProperty Cell(2) {04048846-2BE4-4868-8CDC-B8E6FC7815C5}
Data = 0
DataString = ""
EditIgnore = 0 'False
Ignore = 0 'False
Text = "Cell 2"
TextHAlign = -1
TextVAlign = -1
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
ImageHAlign = 0
ImageVAlign = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= -1
ProgressColorOrientation= -1
ProgressValue = 0
ProgressMax = 0
ProgressStyle = -1
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.CommandButton PopulateCommand
Caption = "Populate"
Height = 375
Left = 5160
TabIndex = 8
Top = 4320
Width = 1095
End
Begin VB.CommandButton ClearButton
Caption = "Clear"
Height = 375
Left = 5160
TabIndex = 7
Top = 4800
Width = 1095
End
Begin VB.CommandButton SaveNestedButton
Caption = "Save (Nested)"
Height = 495
Left = 5160
TabIndex = 6
Top = 2400
Width = 1095
End
Begin VB.CommandButton LoadButton
Caption = "Load"
Height = 375
Left = 5160
TabIndex = 3
Top = 3120
Width = 1095
End
Begin VB.CommandButton SaveFlatButton
Caption = "Save (Flat)"
Height = 495
Left = 5160
TabIndex = 2
Top = 1800
Width = 1095
End
Begin VB.CommandButton CloseButton
Cancel = -1 'True
Caption = "Close"
Height = 375
Left = 5160
TabIndex = 1
Top = 840
Width = 1095
End
Begin VB.Label Label2
Caption = "XML Load/Save Sample"
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 5
Top = 120
Width = 4935
End
Begin VB.Label Label1
Caption = "This sample loads/saves file C:\SftTreeTest.xml"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 4
Top = 480
Width = 4935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const g_FileName As String = "C:\SftTreeTest.xml"
Private Sub ClearButton_Click()
SftTree1.Items.Clear
End Sub
Private Sub CloseButton_Click()
End
End Sub
Private Sub PopulateCommand_Click()
' Populate the tree control with sample data
SftTree1.BulkUpdate = True
SftTree1.Items.Clear
Dim itemIndex As Long
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Item(itemIndex).Level = 1
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Item(itemIndex).Level = 1
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Item(itemIndex).Level = 2
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
itemIndex = SftTree1.Items.Add("New Item, Cell 0")
SftTree1.Cell(itemIndex, 1).Text = "Cell 1"
SftTree1.Cell(itemIndex, 2).Text = "Cell 2"
SftTree1.BulkUpdate = False
End Sub
Private Sub SaveFlatButton_Click()
Dim xmlDoc As New DOMDocument30
Dim RootElementNode As IXMLDOMElement
Dim ItemsElementNode As IXMLDOMElement
Set ItemsElementNode = xmlDoc.createElement("Items")
Set RootElementNode = xmlDoc.appendChild(ItemsElementNode)
' loop through all items and save relevant item information
' as a flat list
Dim i As Integer
For i = 0 To SftTree1.Items.Count - 1
Dim Item As SftTreeItem
Dim ItemElementNode As IXMLDOMElement
Set Item = SftTree1.Item(i)
Dim childNode
Set childNode = AddItemInformation(xmlDoc, Item, False)
RootElementNode.appendChild childNode
Next
' save xml
xmlDoc.save g_FileName
End Sub
Private Sub SaveNestedButton_Click()
Dim xmlDoc As New DOMDocument30
Dim RootElementNode As IXMLDOMElement
Dim ItemsElementNode As IXMLDOMElement
Set ItemsElementNode = xmlDoc.createElement("Items")
Set RootElementNode = xmlDoc.appendChild(ItemsElementNode)
' visit all items and save relevant item information
Dim itemIndex As Long
itemIndex = SftTree1.Items.FirstShown
Do While itemIndex >= 0
Set Item = SftTree1.Item(itemIndex)
Dim childNode
Set childNode = AddItemInformation(xmlDoc, Item, True)
RootElementNode.appendChild childNode
itemIndex = Item.nextSibling
Loop
' save xml
xmlDoc.save g_FileName
End Sub
Function AddItemInformation(ByVal xmlDoc As DOMDocument30, ByVal Item As SftTreeItem, Nested As Boolean)
Set ItemElementNode = xmlDoc.createElement("Item")
' save some of the item properties that are important to your application
ItemElementNode.setAttribute "Data", Item.Data
ItemElementNode.setAttribute "DataString", Item.DataString
If Not Nested Then
ItemElementNode.setAttribute "Level", Item.Level
End If
' loop through all cells and save relevant information
Dim c As Integer
For c = 0 To SftTree1.ColumnsObj.Count - 1
Dim Cell As SftTreeCell
Dim CellElementNode As IXMLDOMElement
Set Cell = Item.Cell(c)
Set CellElementNode = xmlDoc.createElement("Cell")
' save some of the cell properties that are important to your application
CellElementNode.setAttribute "Text", Cell.Text
ItemElementNode.appendChild CellElementNode
Next
' visit all child items (if nested)
If Nested Then
Dim itemIndex As Long
itemIndex = Item.FirstDependent
Do While itemIndex >= 0
Set Item = SftTree1.Item(itemIndex)
Dim childNode
Set childNode = AddItemInformation(xmlDoc, Item, Nested)
ItemElementNode.appendChild childNode
itemIndex = Item.nextSibling
Loop
End If
Set AddItemInformation = ItemElementNode
End Function
Private Sub LoadButton_Click()
' this can load flat or nested xml
' flat xml uses the "Level" property, nested xml rebuilds the tree using the hierarchy
Dim xmlDoc As DOMDocument30
Set xmlDoc = New DOMDocument30
If Not xmlDoc.Load(g_FileName) Then
MsgBox "File " & g_FileName & " could not be loaded."
Exit Sub
End If
SftTree1.BulkUpdate = True
SftTree1.Items.Clear
Dim List As IXMLDOMNodeList
Set List = xmlDoc.selectNodes("/Items/Item")
Dim itemElement As IXMLDOMElement
For Each itemElement In List
AddOneItem itemElement, 0
Next
SftTree1.BulkUpdate = False
End Sub
Sub AddOneItem(itemElement As IXMLDOMElement, Level As Integer)
' add an item
Dim itemIndex As Long
itemIndex = SftTree1.Items.Add("")
' restore all item properties that we saved
Dim Item As SftTreeItem
Set Item = SftTree1.Item(itemIndex)
Item.Data = itemElement.getAttribute("Data")
Item.DataString = itemElement.getAttribute("DataString")
If itemElement.getAttribute("Level") <> "" Then
' we saved the level (flat list), so restore it now
Item.Level = itemElement.getAttribute("Level")
Else
Item.Level = Level
End If
' restore all cell properties that we saved
Dim CellList As IXMLDOMNodeList
Set CellList = itemElement.selectNodes("Cell")
Dim cellElement As IXMLDOMElement
Dim c As Integer
c = 0
For Each cellElement In CellList
Dim Cell As SftTreeCell
Set Cell = Item.Cell(c)
Cell.Text = cellElement.getAttribute("Text")
c = c + 1
Next
' check if there are saved child items (hierarchy)
Dim List As IXMLDOMNodeList
Set List = itemElement.selectNodes("Item")
For Each itemElement In List
AddOneItem itemElement, Level + 1
Next
End Sub