Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/QuickLook/QLPreviewView
Required plugins for this example: MBS MacFrameworks Plugin, MBS MacBase Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/QuickLook/QLPreviewView
This example is the version from Sun, 17th Mar 2012.
Project "QLPreviewView.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CocoaControlMBS1 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS1 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n=new QLPreviewViewMBS(0,0,me.Width,me.Height)
n.shouldCloseWithWindow = true
n.autostarts = True
Return n
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
EventHandler Sub Change()
if me.ListIndex>=0 then
dim file as FolderItem = me.RowTag(me.ListIndex)
// In carbon apps first item is not visible. Second item is Visible. Works fine in Cocoa
n.previewItem = file
else
n.previewItem = nil
end if
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Sub Open()
if not QLPreviewViewMBS.Available then
MsgBox "This example requires Mac OS X 10.6."
quit
end if
dim folder as FolderItem = SpecialFolder.Pictures
dim c as integer = folder.Count
for i as integer = 1 to c
dim file as FolderItem = folder.TrueItem(i)
if file<>nil and file.Directory = false then
Listbox1.AddRow file.DisplayName
Listbox1.RowTag(listbox1.LastIndex) = file
end if
next
End EventHandler
Property n As QLPreviewViewMBS
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
See also:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.