Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/Folderitem Functions


Required plugins for this example: MBS Win Plugin, MBS MacOSX Plugin, MBS Util Plugin, MBS MacClassic Plugin, MBS Picture Plugin

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

This example is the version from Sun, 5th Nov 2022.

Project "Folderitem Functions.xojo_binary_project"
FileTypes
Filetype special/any
End FileTypes
Class AboutFolderitem Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control filename Inherits Label
ControlInstance filename Inherits Label
End Control
Control displayname Inherits Label
ControlInstance displayname Inherits Label
End Control
Control filesize Inherits Label
ControlInstance filesize Inherits Label
End Control
Control directory Inherits Label
ControlInstance directory Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control count Inherits Label
ControlInstance count Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control fileflags Inherits Label
ControlInstance fileflags Inherits Label
End Control
Control StaticText10 Inherits Label
ControlInstance StaticText10 Inherits Label
End Control
Control folderflags Inherits Label
ControlInstance folderflags Inherits Label
End Control
Control icon Inherits Canvas
ControlInstance icon Inherits Canvas
End Control
Control StaticText11 Inherits Label
ControlInstance StaticText11 Inherits Label
End Control
Control onremotevolume Inherits Label
ControlInstance onremotevolume Inherits Label
End Control
Control StaticText9 Inherits Label
ControlInstance StaticText9 Inherits Label
End Control
Control type Inherits Label
ControlInstance type Inherits Label
End Control
Control StaticText14 Inherits Label
ControlInstance StaticText14 Inherits Label
End Control
Control Creator Inherits Label
ControlInstance Creator Inherits Label
End Control
Control StaticText12 Inherits Label
ControlInstance StaticText12 Inherits Label
End Control
Control tcicon Inherits Canvas
ControlInstance tcicon Inherits Canvas
End Control
Control StaticText16 Inherits Label
ControlInstance StaticText16 Inherits Label
End Control
Control StaticText18 Inherits Label
ControlInstance StaticText18 Inherits Label
End Control
Control StaticText20 Inherits Label
ControlInstance StaticText20 Inherits Label
End Control
Control sizevolume Inherits Label
ControlInstance sizevolume Inherits Label
End Control
Control StaticText22 Inherits Label
ControlInstance StaticText22 Inherits Label
End Control
Control freevolume Inherits Label
ControlInstance freevolume Inherits Label
End Control
Control canCatSearch Inherits Label
ControlInstance canCatSearch Inherits Label
End Control
Control StaticText21 Inherits Label
ControlInstance StaticText21 Inherits Label
End Control
Control StaticText23 Inherits Label
ControlInstance StaticText23 Inherits Label
End Control
Control StaticText24 Inherits Label
ControlInstance StaticText24 Inherits Label
End Control
Control trash Inherits Label
ControlInstance trash Inherits Label
End Control
Control desktop Inherits Label
ControlInstance desktop Inherits Label
End Control
Control temp Inherits Label
ControlInstance temp Inherits Label
End Control
Control StaticText25 Inherits Label
ControlInstance StaticText25 Inherits Label
End Control
Control unixpath Inherits Label
ControlInstance unixpath Inherits Label
End Control
Control StaticText26 Inherits Label
ControlInstance StaticText26 Inherits Label
End Control
Control shortpath Inherits Label
ControlInstance shortpath Inherits Label
End Control
Control StaticText28 Inherits Label
ControlInstance StaticText28 Inherits Label
End Control
Control longpath Inherits Label
ControlInstance longpath Inherits Label
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer) #pragma unused action do if obj.folderItemAvailable then info obj.folderItem end if loop until not obj.nextItem End EventHandler
EventHandler Sub Open() me.acceptfileDrop "special/any" info app.ExecutableFile End EventHandler
Function bool(b as boolean) As string if b then return "yes" else return "no" end if End Function
Function flags(i as integer) As string if i>=0 then return format(i,"0") else return "n/a" end if End Function
Function folder(f as folderItem) As string if f<>Nil then return f.NativePath else return "n/a" end if End Function
Sub info(f as folderItem) dim p as Picture if f=nil or not f.exists then msgBox "Invalid Folderitem!" return end if 'RB built in: filename.Text = f.name displayname.text = f.displayName directory.Text = bool(f.directory) count.Text = Str(f.count) #If RBVersion < 2019 filesize.Text = Format((f.length+f.resourceForkLength)/1024,"0")+" KB" type.Text = f.mactype creator.Text = f.maccreator #else filesize.Text = Format((f.length)/1024,"0")+" KB" #EndIf ' MBS Plugin fileflags.text = flags(f.GetFileFlagsMBS) folderflags.text = flags(f.GetFolderFlagsMBS) icon.backdrop=f.IconMBS(32) p=f.IconImageMBS(32) if p<>nil then p.mask.Graphics.DrawPicture f.IconMaskMBS(32),0,0 tcicon.backdrop=p end if onremotevolume.text = bool(f.IsOnRemoteVolumeMBS) cancatSearch.text = Bool(f.VolSupportsCatSearchMBS) sizevolume.text = format(f.VolumeSizeMBS/1024.0/1024.0,"0.0")+" MBytes" freevolume.text = format(f.VolumeFreeSizeMBS/1024.0/1024.0,"0.0")+" MBytes" #if RBVersion < 2019 trash.Text = folder(f.TrashFolder) temp.Text = folder(f.temporaryFolder) desktop.Text = folder(f.DesktopFolder) #Else trash.Text = folder(SpecialFolder.Trash(f)) temp.Text = folder(SpecialFolder.Temporary) desktop.Text = folder(SpecialFolder.Desktop) #EndIf unixpath.Text = f.UnixpathMBS shortpath.Text = f.ShortPathMBS longpath.Text = f.LongPathMBS // in Win Plugin. End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

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


The biggest plugin in space...