Example: /MacCocoa/NSURL Free Disk Space

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/NSURL Free Disk Space


Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/NSURL Free Disk Space

This example is the version from Thu, 8th Sep 2021.

Project "NSURL Free Disk Space.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) Dim theURL As NSURLMBS = Me.RowTag(row) Me.AddRow "Path: ", theURL.path Dim CapacityForImportantUsage As Variant Dim error As NSErrorMBS Dim result As Boolean = theURL.getResourceValue(CapacityForImportantUsage, theURL.NSURLVolumeAvailableCapacityForImportantUsageKey, error) me.AddRow "CapacityForImportantUsage: ",CapacityForImportantUsage.StringValue If error <> Nil Then me.AddRow "Error: ",error.LocalizedDescription End If Dim CapacityForOpportunisticUsage As Variant result = theURL.getResourceValue(CapacityForOpportunisticUsage, theURL.NSURLVolumeAvailableCapacityForOpportunisticUsageKey, error) me.AddRow "CapacityForOpportunisticUsage: ",CapacityForOpportunisticUsage.StringValue If error <> Nil Then me.AddRow "Error: ",error.LocalizedDescription End If Dim CapacityKey As Variant result = theURL.getResourceValue(CapacityKey, theURL.NSURLVolumeAvailableCapacityKey, error) me.AddRow "CapacityKey: ",CapacityKey.StringValue If error <> Nil Then me.AddRow "Error: ",error.LocalizedDescription End If Dim TotalCapacity As Variant result = theURL.getResourceValue(TotalCapacity, theURL.NSURLVolumeTotalCapacityKey, error) me.AddRow "TotalCapacity: ",TotalCapacity.StringValue If error <> Nil Then me.AddRow "Error: ",error.LocalizedDescription End If End EventHandler
EventHandler Sub Open() me.ColumnAlignment(1) = Listbox.AlignRight Dim u As Integer = VolumeCount-1 For i As Integer = 0 To u add Volume(i) Next End EventHandler
End Control
Sub Add(f as FolderItem) Dim theURL As New NSURLMBS(F) list.AddFolder f.DisplayName List.RowTag(List.LastIndex) = theURL list.Expanded(List.LastIndex) = True End Sub
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
End Project

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


💬 Ask a question or report a problem