Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Drop file to see icon parts
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/Drop file to see icon parts
This example is the version from Sun, 17th Mar 2012.
Project "Drop file to see icon parts.rbp"
FileTypes
Filetype special/any
End FileTypes
Class Window1 Inherits Window
Control i128 Inherits Canvas
ControlInstance i128 Inherits Canvas
End Control
Control i48 Inherits Canvas
ControlInstance i48 Inherits Canvas
End Control
Control i32 Inherits Canvas
ControlInstance i32 Inherits Canvas
End Control
Control i16 Inherits Canvas
ControlInstance i16 Inherits Canvas
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control i256 Inherits Canvas
ControlInstance i256 Inherits Canvas
End Control
Control i512 Inherits Canvas
ControlInstance i512 Inherits Canvas
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer) dim p,m as Picture do if obj.folderItemavailable then dim n as NSImageMBS = NSWorkspaceMBS.iconForFile(obj.FolderItem) if n<>Nil then i16.Backdrop = GetIcon(n, 16) i32.Backdrop = GetIcon(n, 32) i48.Backdrop = GetIcon(n, 48) i128.Backdrop = GetIcon(n, 128) i256.Backdrop = GetIcon(n, 256) i512.Backdrop = GetIcon(n, 512) List.DeleteAllRows for each rep as NSImageRepMBS in n.representations List.AddRow str(rep.width) List.cell(List.LastIndex,1) = str(rep.height) List.cell(List.LastIndex,2) = str(rep.bitsPerSample) 'if rep.width = size then 'n.size = NSMakeSizeMBS(size,size) 'Return n.CopyPictureWithMask 'end if ' next end if end if loop until not obj.nextItem End EventHandler
EventHandler Sub Open() acceptfileDrop "special/any" End EventHandler
Function GetIcon(n as NSImageMBS, size as integer) As Picture n.setsize(size,size) ' = NSMakeSizeMBS(size,size) Return n.CopyPictureWithMask End Function
Property Protected i As iconMBS
Property Protected s As iconfamilyMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

Feedback, Comments & Corrections

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





Links
MBS Xojo Plugins