Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

MBS Xojo Plugin Tutorial Videos

NSStatusItemFix Source

Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = &Beenden
Const kEditClear =
End Class

Class Window1
Inherits Window
// Properties
Dim s As NSStatusItemMBS


Dim m As NSMenuMBS


Dim a As NSMenuItemMBS



// Event implementations
Sub Open()
s=new NSStatusItemMBS


dim t as string = "Hello World"
dim len as integer

dim temp as picture=NewPicture(32,32,32)
dim tg as Graphics = temp.Graphics
tg.TextSize=14
tg.TextFont="System"
len=tg.StringWidth(t)

if s.CreateMenu(-1) then
dim pic as picture=NewPicture(len+6, 21, 32)
dim pg as Graphics = pic.Graphics
pg.ForeColor=&c777777
pg.FillRect 0,0,pic.Width, pic.Height

// fill black where you have text,
pg.ForeColor=&c000000
pg.FillRect 3,3,len, 14

dim mask as picture=NewPicture(len+6, 21, 32)
dim mg as Graphics=mask.Graphics

mg.ForeColor=rgb(242,242,242) // 242 is the minimum to be clickable
mg.FillRect 0,0,mask.Width, mask.Height
mg.TextSize=14
mg.TextFont="System"
mg.ForeColor=&c000000
mg.DrawString t,3,16

dim ipic as picture=NewPicture(len+6, 21, 32)
dim ig as Graphics = ipic.Graphics
ig.ForeColor=&c777777
ig.FillRect 0,0,pic.Width, pic.Height

// fill black where you have text,
ig.ForeColor=&cFFFFFF
ig.FillRect 3,3,len, 14

s.image=new NSImageMBS(pic, mask)

s.alternateImage=new NSImageMBS(ipic, mask)

s.HighlightMode=true

m=new NSMenuMBS

a=new NSMenuItemMBS
a.CreateMenuItem "A menu item"
a.Enabled=true
m.AddItem a

s.menu=m
else
MsgBox "This example needs Mac OS X."
end if

End Sub
End Class


All movies




Links
MBS FileMaker Plugins