Xojo Conferences

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 Thu, 16th Nov 2016.
Project "Icons.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Close() if w<>Nil then w.g=nil end if End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean select case key case "1" w.IconSize=16 Return true case "2" w.IconSize=32 Return true case "3" w.IconSize=64 Return true case "4" w.IconSize=128 Return true case "5" w.IconSize=256 Return true case "6" w.IconSize=512 Return true end Select End EventHandler
EventHandler Sub Open() w=new WorkThread w.g=Graphics w.run End EventHandler
Property Private w As workthread
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
Class WorkThread Inherits Thread
EventHandler Sub Run() dim i,c as integer c=VolumeCount-1 for i=0 to c search volume(i) next End EventHandler
Private Sub addicon(f as folderitem) dim q,p,m as Picture if g=nil then Return 'p=f.IconImageMBS(IconSize) ' 'drawicon p p=f.IconMBS(IconSize) drawicon p '// optionally show mask, picture without mask and draw icon ' 'if p<>Nil then 'm=p.CopyMaskMBS 'end if ' 'drawicon m ' 'if p<>Nil then 'q=p.CopyPictureWithoutMaskMBS 'end if ' 'drawicon q ' 'p = new Picture(IconSize,IconSize,32) ' 'f.DrawWideIconMBS p.Graphics, 0, 0, IconSize ' 'drawicon p End Sub
Private Sub drawicon(p as picture) dim x,y as integer dim m as integer m=g.Width/IconSize // draw icon x=n mod m y=(n\m) mod m if p<>Nil then g.DrawPicture p,x*IconSize,y*IconSize end if n=n+1 // clear next field x=n mod m y=(n\m) mod m g.ClearRect x*IconSize,y*IconSize,IconSize,IconSize End Sub
Private Sub search(f as folderitem) dim i,c as integer dim g as FolderItem addicon f c=f.Count for i=1 to c g=f.TrueItem(i) if g=nil then 'ignore elseif g.Directory then search g else addicon g end if next End Sub
Property IconSize As integer = 16
Property g As graphics
Property Private n As Integer
End Class
End Project

Feedback, Comments & Corrections

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

MBS FileMaker blog