Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/MacFileUtil async


Required plugins for this example: MBS MacOSX Plugin, MBS MacClassic Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/MacFileUtil async

This example is the version from Sun, 17th Mar 2012.

Project "MacFileUtil async.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim source, dest as FolderItem source=SpecialFolder.System dest=SpecialFolder.Desktop m=new MyFileOperation m.CopyObject(source, dest, "Copy of System", m.kFSFileOperationDefaultOptions,5.0) List.AddRow "Error: "+str(m.LastError) PushButton4.Enabled=True End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() m.Cancel List.AddRow "Cancel: "+str(m.LastError) me.Enabled=false End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control CurrentItem Inherits Label
ControlInstance CurrentItem Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Bytes Inherits Label
ControlInstance Bytes Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control Objects Inherits Label
ControlInstance Objects Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control visibleObjects Inherits Label
ControlInstance visibleObjects Inherits Label
End Control
Control Throughput Inherits Label
ControlInstance Throughput Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
EventHandler Sub Open() m=new MyFileOperation End EventHandler
Property m As MyFileOperation
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
Class MyFileOperation Inherits MacFileOperationMBS
EventHandler Sub StatusChanged(status as MacFileOperationStatusMBS) dim path as string if status.CurrentItem<>nil then path=status.CurrentItem.UnixpathMBS end if MainWindow.List.AddRow "Status Changed: "+StageString(status.Stage)+", Error: "+str(status.Error)+", Current Item: "+path MainWindow.CurrentItem.text=path MainWindow.Bytes.text=FormatBytes(status.bytesComplete)+" of "+FormatBytes(status.TotalBytes)+", "+FormatBytes(status.BytesRemaining)+" remaining." MainWindow.objects.text=FormatItems(status.ObjectsComplete)+" of "+FormatItems(status.TotalObjects)+", "+FormatItems(status.ObjectsRemaining)+" remaining." MainWindow.visibleObjects.text=FormatItems(status.UserVisibleObjectsComplete)+" of "+FormatItems(status.TotalUserVisibleObjects)+", "+FormatItems(status.UserVisibleObjectsRemaining)+" remaining." MainWindow.Throughput.text=FormatBytes(status.Throughput)+" per second" End EventHandler
Function FormatBytes(n as int64) As string if n=-1 then Return "?" else Return Format(n/1024.0/1024.0,"-0")+" MB" end if End Function
Function FormatItems(n as int64) As string if n=-1 then Return "?" else Return Format(n,"-0") end if End Function
Function StageString(n as integer) As string Select case n case kFSOperationStageComplete Return "Complete" case kFSOperationStagePreflighting Return "Preflighting" case kFSOperationStageRunning Return "Running" case kFSOperationStageUndefined Return "Undefined" end Select End Function
End Class
End Project

See also:

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


The biggest plugin in space...