So, you can easily create a menubar icon and text using NSStatusItemMBS using the handy MBSPlugins thanks to Christian
// Show text in the menubar
s=new NSStatusItemMBS
call s.CreateMenu
s.Title="Hello World"
How would you change the size of the text?
I would try s.attributedTitle with an attributed string where you’ve set the size.
Edit: Just found where I do this in one of my apps (message and nsColor are parameters)
dim a as NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithString(message)
dim t as NSMutableAttributedStringMBS = a.mutableCopy
t.addAttribute(NSAttributedStringMBS.NSFontAttributeName,NSFontMBS.systemFontOfSize(14.0),new NSRangeMBS(0,t.length))
if nsColor <> nil then t.addAttribute(NSAttributedStringMBS.NSForegroundColorAttributeName,nsColor,new NSRangeMBS(0,t.length))
s.attributedTitle = t
1 Like
Thanks Jared. That’s great!
For clarity for anyone else, here’s the complete code (without colour). s is a property of type NSStatusItemMBS
// Show text in the menubar
s=New NSStatusItemMBS
Call s.CreateMenu
Dim a As NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithString("Hello world!")
Dim t As NSMutableAttributedStringMBS = a.mutableCopy
t.addAttribute(NSAttributedStringMBS.NSFontAttributeName,NSFontMBS.systemFontOfSize(12.0),New NSRangeMBS(0,t.length))
s.attributedTitle = t