Example: /MacFrameworks/FSEvents/FSEvents for trash

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem