Example: /MacOSX/Disk Arbitration/Events

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

/MacOSX/Disk Arbitration/Events


Required plugins for this example: MBS MacOSX Plugin, MBS MacCF Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Disk Arbitration/Events

This example is the version from Sat, 10th May 2013.

Project "Events.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() session = new MyDASessionMBS End EventHandler
Property session As MyDASessionMBS
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub Change() PList.DeleteAllRows if me.ListIndex = -1 then // nothing else dim dic as Dictionary = me.RowTag(me.ListIndex) for each key as Variant in dic.keys dim value as Variant = dic.Value(key) if value isa FolderItem then dim f as FolderItem = value value = f.UnixpathMBS end if if value isa Dictionary then value = "<dictionary>" end if if value isa CFUUIDMBS then dim u as CFUUIDMBS = value value = u.StringValue end if PList.AddRow key, value next end if End EventHandler
End Control
Control PList Inherits Listbox
ControlInstance PList Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyDASessionMBS Inherits DASessionMBS
EventHandler Sub Appeared(disk as DADiskMBS) dim dic as Dictionary = disk.Description dim name as string = getname(dic, disk) log "Disk appeared: "+name, dic End EventHandler
EventHandler Sub DescriptionChanged(disk as DADiskMBS, keys() as string) dim dic as Dictionary = disk.Description dim name as string = getname(dic, disk) log "Disk description changed for "+name, dic Break End EventHandler
EventHandler Sub Disappeared(disk as DADiskMBS) dim dic as Dictionary = disk.Description dim name as string = getname(dic, disk) log "Disk disappeared: "+name, dic End EventHandler
EventHandler Sub Peek(disk as DADiskMBS) dim dic as Dictionary = disk.Description dim name as string = getname(dic, disk) log "Disk peek: "+name, dic break End EventHandler
Function getname(dic as Dictionary, disk as DADiskMBS) As string if dic.HasKey(DADiskMBS.kDADiskDescriptionVolumeNameKey) then Return dic.Value(DADiskMBS.kDADiskDescriptionVolumeNameKey) end if if dic.HasKey(DADiskMBS.kDADiskDescriptionMediaNameKey) then Return dic.Value(DADiskMBS.kDADiskDescriptionMediaNameKey) end if if dic.HasKey(DADiskMBS.kDADiskDescriptionDevicePathKey) then Return dic.Value(DADiskMBS.kDADiskDescriptionDevicePathKey) end if if dic.HasKey(DADiskMBS.kDADiskDescriptionVolumeNameKey) then Return dic.Value(DADiskMBS.kDADiskDescriptionVolumeNameKey) end if if dic.HasKey(DADiskMBS.kDADiskDescriptionVolumePathKey) then dim n as folderitem = dic.Value(DADiskMBS.kDADiskDescriptionVolumePathKey) return n.Name end if Return disk.BSDName End Function
Sub log(Message as string, dic as Dictionary = nil) dim d as new date dim l as listbox = window1.List l.AddRow d.ShortTime, message l.ScrollPosition = l.LastIndex l.RowTag(l.LastIndex) = dic End Sub
End Class
End Project

See also:

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


💬 Ask a question or report a problem