Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

Required plugins for this example: MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Fonts/FontManager
This example is the version from Sun, 17th Mar 2012.
Project "FontManager.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
EventHandler Sub Open() dim fi as new FontIteratorMBS dim fo as FontMBS dim fa as FontFamilyMBS dim style as integer fo=fi.NextFont while fo<>Nil me.AddRow str(fo.Handle) fa=fo.FontFamily(style) if fa<>Nil then me.cell(me.LastIndex,1)=fa.Name else me.cell(me.LastIndex,1)="no family?" end if me.cell(me.LastIndex,2)=StyleName(style) fo=fi.NextFont wend End EventHandler
End Control
Control Listbox2 Inherits Listbox
ControlInstance Listbox2 Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) dim fa as FontFamilyMBS dim fo as FontMBS dim ff as FontFamilyFontIteratorMBS dim Style,size as integer if row<me.ListCount then fa=me.Celltag(row,0) if fa<>nil then ff=fa.Fonts if ff<>Nil then fo=ff.NextFont(Style,size) while fo<>Nil me.Addrow str(fo.Handle) me.Cell(me.LastIndex,1)=str(size)+" "+StyleName(style) fo=ff.NextFont(Style,size) wend end if end if end if End EventHandler
EventHandler Sub Open() dim fi as new FontFamilyIteratorMBS dim fa as FontFamilyMBS fa=fi.NextFontFamily while fa<>Nil me.Addfolder str(fa.Handle) me.cell(me.lastindex,1)=fa.Name me.CellTag(me.LastIndex,0)=fa fa=fi.NextFontFamily wend End EventHandler
End Control
Function StyleName(n as integer) As string if n=0 then Return "" end if dim s(-1) as string if Bitwise.BitAnd(n,1)=1 then s.Append "bold" end if if Bitwise.BitAnd(n,2)=2 then s.Append "italic" end if if Bitwise.BitAnd(n,4)=4 then s.Append "underline" end if if Bitwise.BitAnd(n,8)=8 then s.Append "outline" end if if Bitwise.BitAnd(n,16)=16 then s.Append "shadow" end if if Bitwise.BitAnd(n,32)=32 then s.Append "condense" end if if Bitwise.BitAnd(n,64)=64 then s.Append "extend" end if Return Join(s,", ") End Function
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

Feedback, Comments & Corrections

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

MBS Xojo Plugins