home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 February
/
PCWK0297.iso
/
envelop
/
envelop.5
/
Tools
/
Bootcamp
/
advanced
/
indented
/
indented.eto
< prev
next >
Wrap
Text File
|
1996-07-08
|
4KB
|
143 lines
Type IndentedListMasterForm From SampleMasterForm
Dim DirBox As New IndentedList
Dim FILE_ATTRIBUTE_DIRECTORY As Integer
Dim Level As Integer
Dim InsertAtIndex As Integer
Dim FILE_ICON As Integer
Dim DIR_ICON As Integer
Dim Icons As New Bitmap
Dim Margin As Integer
Dim LblPath As New Label
Dim DIR_COLLAPSED_ICON As Integer
Dim DIR_EXPANDED_ICON As Integer
' METHODS for object: IndentedListMasterForm
Sub AddFileToList(ByVal path as string, ByVal attr as long)
dim I as Integer
path = ClipString(path)
If attr And FILE_ATTRIBUTE_DIRECTORY Then
I = DirBox.InsertItem(path, DIR_COLLAPSED_ICON, Level + 1, InsertAtIndex)
DirBox.SetItemCanExpand(I, True)
Else
I = DirBox.InsertItem(path, FILE_ICON, Level + 1, InsertAtIndex)
DirBox.SetItemCanExpand(I, False)
End If
DirBox.SetItemData(I, InsertAtIndex - 1)
End Sub
Function ClipString(OldString as string) as String
Dim I as integer
Dim FileObj as New File
FileObj.FileName = OldString
ClipString = FileObj.Name & FileObj.Extension
End Function
Sub DirBox_Click()
LblPath.Text = RecreatePath(DirBox.ListIndex)
End Sub
Sub DirBox_Collapsed(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
DirBox.SetItemIcon(itemIndex, DIR_COLLAPSED_ICON)
DirBox_Click
End Sub
Sub DirBox_Expand(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
Level = DirBox.ItemLevel(itemIndex)
InsertAtIndex = itemIndex + 1
GenerateDirList(RecreatePath(itemIndex))
DirBox.SetItemIcon(itemIndex, DIR_EXPANDED_ICON)
DirBox_Click
End Sub
Sub ExitApplication_Click()
Dim F Strictly As SampleMasterForm
F = Me
IndentedListMasterForm.Hide
F.ExitApplication_Click
End Sub
Sub GenerateDirList(path as string)
Dim dir As New Directory
dir.Path = path
dir.EnumContents(Me, "AddFileToList", "*.*", False)
End Sub
Sub Initialize
DirBox.ExpandOnDblClick = True
LblPath.Caption = ""
InsertAtIndex = 0
Level = -1
DirBox.Clear
GenerateDirList("C:\")
DirBox.Reset
End Sub
Function RecreatePath(byVal branch as long) as string
Dim Path as string
While branch > -1
Path = "\" & DirBox.ItemString(branch) & Path
branch = DirBox.ItemData(branch)
Wend
Path = "C:" & Path
RecreatePath = Path
End Function
Sub ResetApplication_Click()
LoadForm
Initialize
End Sub
Sub Resize()
LblPath.Move(Margin, Margin, ScaleWidth - (2 * Margin), 300)
DirBox.Move(Margin, (Margin * 2) + 300, ScaleWidth - (2 * Margin), ScaleHeight - ((3 * Margin) + 300))
End Sub
End Type
Begin Code
' Reconstruction commands for object: IndentedListMasterForm
'
With IndentedListMasterForm
.Caption := "Indented List Sample"
.Move(3900, 2490, 5415, 7725)
.FILE_ATTRIBUTE_DIRECTORY := 16
.Level := 0
.InsertAtIndex := 1
.FILE_ICON := 2
.DIR_ICON := 0
.Margin := 100
.DIR_COLLAPSED_ICON := 0
.DIR_EXPANDED_ICON := 3
.SampleDir := "W:\bootcamp\advanced\indented\"
.SampleName := "indented"
With .DirBox
.ZOrder := 2
.Move(100, 500, 5095, 6435)
.ExpandOnDblClick := True
.IconBitmap := IndentedListMasterForm.Icons
.IconHeight := 12
.IconWidth := 12
.Sorted := True
.HighlightStyle := "FullLine"
End With 'IndentedListMasterForm.DirBox
With .Icons
.LoadType := "MemoryBased"
.FileName := "indented.ero"
.ResId := 0
End With 'IndentedListMasterForm.Icons
With .LblPath
.Caption := ""
.ZOrder := 1
.Move(100, 100, 5095, 300)
End With 'IndentedListMasterForm.LblPath
With .helpfile
.FileName := "W:\bootcamp\advanced\indented\indented.hlp"
End With 'IndentedListMasterForm.helpfile
End With 'IndentedListMasterForm
End Code