In a module I have a property called item1 (As NSStatusItem), and a method called ShowStatusItem, which creates an NSStatusItem (see the code below):
[code] // CREATE AN NSSTATUSITEM IN THE OS X MENUBAR
dim bar as NSStatusBar = NSStatusBar.SystemStatusBar
item1 = bar.CreateStatusItem(NSStatusBar.NSVariableStatusItemLength, AddressOf StatusItemHandler)
item1.highlightMode = true
item1.Image = NSStatusItemImage
item1.AlternateImage = NSStatusItemImage
// APPEND MENU ENTRIES
dim mmenu as new NSMenu
call mmenu.Append(“Open myApp”)
// DISPLAY THE MENU
item1.menu = mmenu[/code]
I call the method like this from the app.open event:
However, when I try to build I get the following error:
When I run the code from the app.open event - it all world perfectly, but when I put the property and method into a module - I get the error.
(I decided to put the method and property into a module, because I need to change the NSStatusItem image elsewhere in my app - when a certain window opens).
Could someone please help me, as to how / where I put my method and property in order to create the NSStatusItem, and also to allow me to update the image at a later date.
Thank you all in advance.