Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Dock Items
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Dock Items
This example is the version from Sun, 17th Mar 2012.
Project "Dock Items.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Sub Open() // Reads file names from persistent dock applications and puts them into the list dim pref as new CFPreferencesMBS dim persistentapps as CFStringMBS = NewCFStringMBS("persistent-apps") dim ApplicationID as CFStringMBS = NewCFStringMBS("com.apple.dock") dim tiledata as CFStringMBS = NewCFStringMBS("tile-data") dim filelabel as CFStringMBS = NewCFStringMBS("file-label") // get the array of persistent applications from dock preferences dim o as CFObjectMBS = pref.CopyValue(persistentapps, ApplicationID, pref.kCFPreferencesCurrentUser, pref.kCFPreferencesAnyHost) if o isa CFArrayMBS then dim a as CFArrayMBS = CFArrayMBS(o) // walk over all items in array dim c as integer = a.Count-1 for i as integer = 0 to c // get dictionary describing item o = a.Item(i) if o isa CFDictionaryMBS then dim d as CFDictionaryMBS = CFDictionaryMBS(o) // and pick tile data dictionary o = d.Value(tiledata) if o isa CFDictionaryMBS then d = CFDictionaryMBS(o) // and pick there the file label o = d.Value(filelabel) if o isa CFStringMBS then // and display it dim name as string = CFStringMBS(o).str List.AddRow name end if end if end if next else MsgBox "Failed to read dock preferences." end if End EventHandler
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
End Project

Feedback, Comments & Corrections

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

MBS Xojo PDF Plugins