You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Display Virtual Volume
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub OpenDocument(item As FolderItem)
dim w as new mainwindow
w.show item
End EventHandler
End Class
Class MainWindow Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
EventHandler Sub ExpandRow(row As Integer)
dim g,f as FolderItem
dim i,c as integer
if row>=0 and row<listbox1.ListCount then
f=listbox1.celltag(row,0)
if f<>nil then
c=f.Count
for i=1 to c
g=f.TrueItem(i)
add g
next
end if
end if
End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
if listbox1.ListIndex < 0 then Return
dim f as FolderItem = Listbox1.CellTag(listbox1.ListIndex,0)
if f = nil or f.Directory then Return
dim name as string = listbox1.Cell(Listbox1.ListIndex,0)
dim g as FolderItem = GetSaveFolderItem(FileTypes1.any, name)
if g = nil then Return
dim bi as BinaryStream = BinaryStream.Open(f, false)
dim bo as BinaryStream = BinaryStream.Create(g, true)
bo.Write bi.Read(bi.Length)
bo.Close
bi.Close
Exception io as IOException
MsgBox "IOException: "+io.message
End EventHandler
End Control
Sub add(f as folderitem)
if f.Directory then
ListBox1.AddFolder f.DisplayName
else
ListBox1.AddRow f.DisplayName
end if
Listbox1.CellTag(listbox1.LastIndex,0)=f
Listbox1.cell(ListBox1.LastIndex,1)=Format(f.Length,"0")
End Sub
Sub show(f as folderitem)
dim v as VirtualVolume
dim r as FolderItem
Title=f.DisplayName
v=f.OpenAsVirtualVolume
if v<>nil then
r=v.Root
add r
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar