Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/FileList/FileList
This example is the version from Tue, 4th Feb 2019.
Project "FileList.rbp"
Class MainWindow Inherits Window
Control List Inherits ListBox
ControlInstance List Inherits ListBox
EventHandler Sub Change() dim s as string if me.ListIndex=-1 then Title="" else s=me.Cell(me.ListIndex,0) Title=s+" "+str(len(s))+" "+str(lenb(s)) end if End EventHandler
EventHandler Sub DoubleClick() dim i as integer i=me.Celltag(me.ListIndex,0) f.item(i).Launch Exception End EventHandler
End Control
EventHandler Sub Open() dim list as listbox = self.List dim i,c as integer dim s as string dim d as date MakeTestFile // Make a test file to test unicode f = new FileListMBS(SpecialFolder.Desktop) c = f.Count Title=str(c)+" items on the desktop" c=c-1 for i=0 to c s=f.Name(i) List.AddRow s'+" "+str(len(s))+" "+str(lenb(s)) if not f.Directory(i) then List.Cell(List.LastIndex,1)=format((f.PhysicalDataLength(i)+f.PhysicalResourceLength(i))/1024,"0")+" KB" end if if f.Visible(i) then s="visible" else s="invisible" end if if f.Directory(i) then s=s+", directory" end if List.Cell(List.LastIndex,2)=s d=f.ModificationDate(i, false) if d = nil then List.Cell(List.LastIndex,3)="?" else List.Cell(List.LastIndex,3)=d.ShortDate+" "+d.ShortTime end if d=new date d=f.CreationDate(i, false) if d = nil then List.Cell(List.LastIndex,4)="?" else List.Cell(List.LastIndex,4)=d.ShortDate+" "+d.ShortTime end if d=f.LastAccessDate(i, false) if d = nil then List.Cell(List.LastIndex,5)="?" else List.Cell(List.LastIndex,5)=d.ShortDate+" "+d.ShortTime end if s=Fix(f.Type(i))+"/"+Fix(f.Creator(i)) if s<>"/" then List.Cell(List.LastIndex,6)=s end if List.Cell(List.LastIndex,7)=hex(f.NodeID(i)) List.Cell(List.LastIndex,8)=str(f.IsHardLinked(i)) List.Celltag(List.LastIndex,0)=i // for double click next End EventHandler
Function Fix(s as string) As string dim i,c as integer dim z,t as string // removes non printable characters c=len(s) for i=1 to c z=mid(s,i,1) if asc(z)<32 then t=T+" " else t=T+z end if next Return t End Function
Protected Sub MakeTestFile() // create a test file with a special unicode file name dim s as string = "ƋƋƴNJƮƏ.txt" dim f as FolderItem = SpecialFolder.Desktop.Child(s) dim t as TextOutputStream = f.CreateTextFile t.Write "Hello" End Sub
Property Protected base As double
Property Protected f As FileListMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.

MBS Xojo blog