Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/FileList/Koingo FileList Example
Required plugins for this example: MBS MacClassic Plugin, MBS Picture Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/FileList/Koingo FileList Example
This example is the version from Wed, 16th Feb 2016.
Project "Koingo FileList Example.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control lstFiles Inherits ListBox
ControlInstance lstFiles Inherits ListBox
EventHandler Sub ExpandRow(row As Integer) ListMyFolder(me.CellTag(row,0)) End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean if asc(key)=13 or asc(key)=3 or asc(key)=32 and me.ListIndex>=0 then me.Expanded(me.ListIndex)=not me.Expanded(me.ListIndex) Return true end if End EventHandler
End Control
EventHandler Sub Open() ListMyFolder(SpecialFolder.Documents.Parent) End EventHandler
Protected Function CombinePictureMask(pMain As Picture, pMask As Picture) As Picture Dim P As Picture P = New Picture(pMain.Width,pMain.Height,32) P.Graphics.DrawPicture pMain,0,0 P.Mask.Graphics.DrawPicture pMask,0,0 Return P End Function
Protected Sub ListMyFolder(F As FolderItem) Dim i, iEnd As Integer Dim myFiles As FileListMBS Dim FTemp As FolderItem myFiles = New FileListMBS(F) iEnd = myFiles.Count-1 For i = 0 to iEnd FTemp = myFiles.Item(i) If FTemp.Directory Then lstFiles.AddFolder FTemp.DisplayName Else lstFiles.AddRow FTemp.DisplayName End If lstFiles.CellTag(lstFiles.LastIndex,0) = FTemp lstFiles.Cell(lstFiles.LastIndex,1) = FTemp.KindMBS lstFiles.RowPicture(lstFiles.LastIndex) = CombinePictureMask(FTemp.IconImageMBS(16),FTemp.IconMaskMBS(16)) Next lstFiles.Sort() lstFiles.ScrollBarVertical = lstFiles.ScrollBarVertical //Fix RB Composite Scrollbar Bug End Sub
Protected Sub ListMyFolderRB(nParent As FolderItem) Dim F As FolderItem Dim i, iEnd As Integer F = nParent iEnd = F.Count For i = 1 to iEnd If F.TrueItem(i).Directory Then lstFiles.AddFolder F.TrueItem(i).DisplayName Else lstFiles.AddRow F.TrueItem(i).DisplayName End If lstFiles.CellTag(lstFiles.LastIndex,0) = F.TrueItem(i) lstFiles.Cell(lstFiles.LastIndex,1) = F.TrueItem(i).KindMBS lstFiles.RowPicture(lstFiles.LastIndex) = CombinePictureMask(F.TrueItem(i).IconImageMBS(16),F.TrueItem(i).IconMaskMBS(16)) Next lstFiles.Sort() lstFiles.ScrollBarVertical = lstFiles.ScrollBarVertical //Fix RB Composite Scrollbar Bug 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
End Project

Feedback, Comments & Corrections

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

MBS Xojo Plugins