Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/DiscRecording/DataBurn with Events and Notification
Function:
Required plugins for this example: MBS MacBase 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: /MacCocoa/DiscRecording/DataBurn with Events and Notification
This example is the version from Sun, 17th Mar 2012.
Project "DataBurn with Events and Notification.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() nc = new DRNotificationCenterMBS m = new MyNSNotificationObserverMBS dim track as DRTrackMBS logwindow.Show // we need a track track=CreateTrack if track<>nil then bsp=new MyDRBurnSetupPanelMBS // set a few options bsp.setCanSelectAppendableMedia true bsp.setCanSelectTestBurn true if bsp.runSetupPanel=bsp.NSOKButton then burn = bsp.burnObject // And start off the burn itself. This will put up the progress dialog // and do all the nice pretty things that a happy app does. nc.addObserver(m, DRBurnMBS.DRBurnStatusChangedNotification, burn) burn.writeLayout(track) else MsgBox "You pressed cancel." end if end if End EventHandler
Function CreateTrack() As DRTrackMBS dim f as FolderItem dim fo as DRFolderMBS f=SelectFolder if f<>nil then fo=DRFolderMBS.folderWithPath(f) if fo<>Nil then Return DRTrackMBS.trackForRootFolder(fo) end if end if End Function
Property bpp As MyDRBurnProgressPanelMBS
Property bsp As MyDRBurnSetupPanelMBS
Property burn As DRBurnMBS
Property m As MyNSNotificationObserverMBS
Property nc As DRNotificationCenterMBS
End Class
Class logwindow Inherits Window
Control list Inherits Listbox
ControlInstance list Inherits Listbox
End Control
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
Class MyDRBurnSetupPanelMBS Inherits DRBurnSetupPanelMBS
EventHandler Function DeviceContainsSuitableMedia(device as DRDeviceMBS, byref prompt as string) As boolean System.DebugLog "DeviceContainsSuitableMedia in Realbasic" logwindow.list.addrow "DeviceContainsSuitableMedia: "+device.displayName app.YieldToNextThread // allow device Return true End EventHandler
EventHandler Function DeviceCouldBeTarget(device as DRDeviceMBS) As boolean System.DebugLog "DeviceCouldBeTarget in Realbasic" logwindow.list.addrow "DeviceCouldBeTarget: "+device.displayName app.YieldToNextThread // allow device Return true End EventHandler
EventHandler Sub DeviceSelectionChanged(device as DRDeviceMBS) System.DebugLog "DeviceSelectionChanged in Realbasic" if device=nil then logwindow.list.addrow "DeviceSelectionChanged: nil" else logwindow.list.addrow "DeviceSelectionChanged: "+device.displayName end if app.YieldToNextThread End EventHandler
EventHandler Function SetupPanelShouldHandleMediaReservations() As boolean System.DebugLog "SetupPanelShouldHandleMediaReservation in Realbasic" logwindow.list.addrow "SetupPanelShouldHandleMediaReservation" app.YieldToNextThread // let the panel do it's job Return true End EventHandler
End Class
Class MyDRBurnProgressPanelMBS Inherits DRBurnProgressPanelMBS
EventHandler Function burnProgressPanelBurnDidFinish(burn as DRBurnMBS) As boolean System.DebugLog "burnProgressPanelBurnDidFinish in Realbasic" logwindow.list.addrow "burnProgressPanelBurnDidFinish Event" app.YieldToNextThread End EventHandler
EventHandler Sub burnProgressPanelDidFinish() System.DebugLog "burnProgressPanelDidFinish in Realbasic" logwindow.list.addrow "burnProgressPanelDidFinish Event" app.YieldToNextThread End EventHandler
EventHandler Sub burnProgressPanelWillBegin() System.DebugLog "burnProgressPanelBurnWillBegin in Realbasic" logwindow.list.addrow "burnProgressPanelBurnWillBegin Event" app.YieldToNextThread End EventHandler
End Class
Class MyNSNotificationObserverMBS Inherits NSNotificationObserverMBS
EventHandler Sub GotNotification(notification as NSNotificationMBS) dim d as Dictionary = Notification.userInfo if d<>nil then if d.HasKey(DRBurnMBS.DRStatusPercentCompleteKey) then logwindow.list.AddRow d.Value(DRBurnMBS.DRStatusPercentCompleteKey).StringValue end if end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo blog