Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/Image Capture/Image Capture Views
Function:
Required plugins for this example: MBS AVFoundation Plugin, MBS MacBase Plugin, MBS MacCG Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/Image Capture/Image Capture Views
This example is the version from Tue, 14th Jul 2014.
Project "Image Capture Views.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetCocoa then MsgBox "Only for Mac Cocoa!" end if End EventHandler
End Class
Class SelectWindow Inherits Window
Control SelectButton Inherits PushButton
ControlInstance SelectButton Inherits PushButton
EventHandler Sub Action() System.DebugLog CurrentMethodName dim v as IKDeviceBrowserViewMBS = View.View dim d as Variant = v.selectedDevice if d <> nil then if d isa ICCameraDeviceMBS then dim c as ICCameraDeviceMBS = d dim cw as new CameraWindow cw.init c end if if d isa ICScannerDeviceMBS then dim c as ICScannerDeviceMBS = d dim cw as new ScannerWindow cw.init c end if end if End EventHandler
End Control
Control view Inherits IKDeviceBrowserViewControlMBS
ControlInstance view Inherits IKDeviceBrowserViewControlMBS
EventHandler Sub Open() System.DebugLog CurrentMethodName dim v as IKDeviceBrowserViewMBS = me.View v.displaysLocalCameras = true v.displaysLocalScanners = true v.displaysNetworkCameras = true v.displaysNetworkScanners = true End EventHandler
EventHandler Sub SelectionDidChange(device as ICDeviceMBS) System.DebugLog CurrentMethodName if device = nil then SelectButton.Enabled = false else SelectButton.Enabled = true end if End EventHandler
End Control
EventHandler Sub Open() System.DebugLog CurrentMethodName events = new ImageCaptureEvents End EventHandler
Property events As ImageCaptureEvents
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class ScannerWindow Inherits Window
Control view Inherits IKScannerDeviceViewControlMBS
ControlInstance view Inherits IKScannerDeviceViewControlMBS
EventHandler Sub DidEncounterError(error as NSErrorMBS) System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub DidScanToURL(url as String, file as FolderItem, fileData as MemoryBlock, error as NSErrorMBS) System.DebugLog CurrentMethodName file.Launch End EventHandler
End Control
EventHandler Sub Open() System.DebugLog CurrentMethodName End EventHandler
Sub Init(device as ICScannerDeviceMBS) System.DebugLog CurrentMethodName self.device = device dim v as IKScannerDeviceViewMBS = view.View v.documentName = "test" v.hasDisplayModeSimple = true v.hasDisplayModeAdvanced = true v.scanControlLabel = "Scan" v.overviewControlLabel = "Overview" v.mode = v.IKScannerDeviceViewDisplayModeSimple v.transferMode = v.IKScannerDeviceViewTransferModeFileBased v.displaysPostProcessApplicationControl = true v.displaysDownloadsDirectoryControl = true v.downloadsFolder = SpecialFolder.Desktop v.isHidden = false v.scannerDevice = device if not device.HasOpenSession then device.requestOpenSession end if End Sub
Property device As ICScannerDeviceMBS
End Class
Class CameraWindow Inherits Window
Control view Inherits IKCameraDeviceViewControlMBS
ControlInstance view Inherits IKCameraDeviceViewControlMBS
EventHandler Sub DidDownloadFile(CameraFile as ICCameraFileMBS, URL as string, File as folderItem, data as MemoryBlock, error as NSErrorMBS) System.DebugLog CurrentMethodName file.Launch End EventHandler
EventHandler Sub DidEncounterError(Error as NSErrorMBS) System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub SelectionDidChange() System.DebugLog CurrentMethodName End EventHandler
End Control
Sub Init(device as ICCameraDeviceMBS) System.DebugLog CurrentMethodName self.device = device dim v as IKCameraDeviceViewMBS = view.View v.downloadAllControlLabel = "Download All" v.downloadSelectedControlLabel = "Download" v.displaysDownloadsDirectoryControl = true v.displaysPostProcessApplicationControl = true v.transferMode = v.IKCameraDeviceViewTransferModeFileBased v.mode = v.IKCameraDeviceViewDisplayModeTable v.downloadsFolder = SpecialFolder.Desktop v.isHidden = false v.cameraDevice = device if not device.HasOpenSession then device.requestOpenSession end if End Sub
Property device As ICCameraDeviceMBS
End Class
Class ImageCaptureEvents Inherits ImageCaptureEventsMBS
EventHandler Sub deviceDidEncounterError(device as ICDeviceMBS, error as NSErrorMBS) System.DebugLog CurrentMethodName System.DebugLog error.LocalizedDescription End EventHandler
EventHandler Sub deviceDidRemove(device as ICDeviceMBS) System.DebugLog CurrentMethodName if device.HasOpenSession then device.requestCloseSession end if End EventHandler
EventHandler Sub scannerDeviceDidBecomeAvailable(scanner as ICScannerDeviceMBS) System.DebugLog CurrentMethodName if not scanner.HasOpenSession then scanner.requestOpenSession end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins