Platforms to show: All Mac Windows Linux Cross-Platform
/MacControls/Quartz Composer Control/QCViewControl
Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin, MBS MacControls Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/Quartz Composer Control/QCViewControl
This example is the version from Thu, 6th Apr 2016.
Project "QCViewControl.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
if not TargetMachO then
MsgBox "This project requires Mac OS X."
quit
end if
End EventHandler
End Class
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
v.unloadComposition
dim f as FolderItem = GetFolderItem("/System/Library/Compositions/Pixellate.qtz", FolderItem.PathTypeShell)
if v.loadCompositionFromFile(f) then
if v.setValueForInputKey(NSImage, "_protocolInput_Image") then
if v.startRendering then
// okay
end if
end if
else
MsgBox "Failed to load!"
end if
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
v.unloadComposition
dim f as FolderItem = GetFolderItem("/System/Library/Compositions/Kaleidescope.qtz", FolderItem.PathTypeShell)
if v.loadCompositionFromFile(f) then
if v.setValueForInputKey(NSImage, "_protocolInput_Image") then
if v.startRendering then
// okay
end if
end if
else
MsgBox "Failed to load!"
end if
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
v.unloadComposition
dim f as FolderItem = GetFolderItem("/System/Library/Compositions/Tracer.qtz", FolderItem.PathTypeShell)
if v.loadCompositionFromFile(f) then
if v.setValueForInputKey(NSImage, "_protocolInput_Image") then
if v.startRendering then
// okay
end if
end if
else
MsgBox "Failed to load!"
end if
End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
v.unloadComposition
dim f as FolderItem = GetFolderItem("/System/Library/Compositions/Travelator.qtz", FolderItem.PathTypeShell)
if v.loadCompositionFromFile(f) then
if v.startRendering then
// okay
end if
else
MsgBox "Failed to load!"
end if
End EventHandler
End Control
Control QCViewControlMBS1 Inherits QCViewControlMBS
ControlInstance QCViewControlMBS1 Inherits QCViewControlMBS
EventHandler Sub DidStartRendering()
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Sub DidStopRendering()
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Sub Open()
image = LogoMBS(500)
NSImage = new NSImageMBS(image)
v = me.view
if v = nil then
Break
end if
dim f as FolderItem = GetFolderItem("/System/Library/Compositions/Kaleidescope.qtz", FolderItem.PathTypeShell)
if v.loadCompositionFromFile(f) then
if v.setValueForInputKey(NSImage, "_protocolInput_Image") then
v.autostartsRendering=true
// display input keys:
'dim s(-1) as string = v.inputKeys
'MsgBox Join(s,EndOfLine)
end if
else
MsgBox "Failed to load!"
end if
End EventHandler
End Control
Property image As Picture
Property nsimage As NSImageMBS
Property v As QCViewMBS
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
See also:
The items on this page are in the following plugins: MBS MacControls Plugin.