Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/FSEvents/FSEvents for trash


Required plugins for this example: MBS MacOSX Plugin, MBS MacFrameworks Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/FSEvents/FSEvents for trash

This example is the version from Fri, 12th Nov 2015.

Project "FSEvents for trash.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Close() for each f as FSEventsMBS in events f.stop next End EventHandler
EventHandler Sub Open() dim trashes(-1) as string for x as integer = 1 to VolumeCount dim volume as FolderItem = volume(x-1) dim Trash as FolderItem = volume.TrashFolder if Trash<>nil then dim TrashPath as String = Trash.UnixpathMBS if trashes.IndexOf(TrashPath)<0 then trashes.Append TrashPath Register TrashPath end if end if next dim Trash as FolderItem = SpecialFolder.Trash dim TrashPath as String = Trash.UnixpathMBS if trashes.IndexOf(TrashPath)<0 then trashes.Append TrashPath Register TrashPath end if End EventHandler
Sub Register(path as string) dim eventid as UInt64 = FSEventsMBS.GetCurrentEventId dim flags as integer = FSEventsMBS.kFSEventStreamCreateFlagNone dim latency as Double = 2.0 dim f as new FSEvents(path, eventid, latency, flags) f.mypath = path 'f.Show if not f.Start then MsgBox "Failed to start." end if events.Append f End Sub
Property events() As fsevents
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
Class FSEvents Inherits FSEventsMBS
EventHandler Sub Callback(index as integer, count as integer, path as string, flags as integer, eventID as UInt64) dim l as listbox l=window1.ListBox1 l.AddRow path l.Cell(l.LastIndex,1)=hex(flags) l.Cell(l.LastIndex,2)=hex(eventID) End EventHandler
Property mypath As string
End Class
End Project

See also:

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


The biggest plugin in space...