Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Icon/Icons
This example is the version from Wed, 14th May 2019.
Project "Icons.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control IconTimer Inherits Timer
ControlInstance IconTimer Inherits Timer
EventHandler Sub Action()
Const w = 128
If files.Ubound >= 0 then
Dim IconsPerRow As Integer = (pic.Width / w)
Dim f As FolderItem = files(0)
files.Remove 0
Dim p As Picture = f.IconMBS(w)
if p <> nil then
Dim x As Integer = n mod IconsPerRow
Dim y As Integer = n \ IconsPerRow
pic.Graphics.DrawPicture p, x * w, y * w, p.width, p.Height, 0, 0, w, w
n = n + 1
out.Invalidate
End If
End If
End EventHandler
End Control
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
If pic <> Nil Then
g.DrawPicture pic, 0, 0, pic.Width / 2, pic.Height/2, 0, 0, pic.Width, pic.Height
End If
End EventHandler
End Control
EventHandler Sub Open()
pic = New Picture(Width*2, Height*2, 32)
search SpecialFolder.Applications, 0
End EventHandler
Private Sub search(f as folderitem, depth as integer)
dim c as integer = f.Count
for i as integer = 1 to c
dim g as FolderItem = f.TrueItem(i)
if g=nil then
'ignore
else
dim n as string = g.Name
if Right(n,4) = ".app" then
files.append g
Elseif g.Directory Then
If depth < 5 Then
search g, depth + 1
End If
Else
// other files
'files.append g
end if
end if
next
End Sub
Property files() As FolderItem
Property n As Integer
Property pic As Picture
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
End Project
The items on this page are in the following plugins: MBS Picture Plugin.