Example: /MacCocoa/NSStatusItem/StatusItem easy

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/NSStatusItem/StatusItem easy


Required plugins for this example: MBS MacCocoa Plugin, MBS MacBase Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/NSStatusItem/StatusItem easy

This example is the version from Sun, 17th Mar 2012.

Project "StatusItem easy.xojo_binary_project"
Class Window1 Inherits Window
EventHandler Sub Open() e = new NSStatusItemMBS call e.CreateMenu(-1) e.Title = "Test" e.HighlightMode=true // clickable m=new NSMenuMBS dim a as new MyCocoaMenuItemMBS a.CreateMenuItem "Some menu entry" a.Enabled=true a.Tag=1 items.Append a // so RB doesn't free the object. m.AddItem a dim b as new MyCocoaMenuItemMBS b.CreateSeparator items.Append b m.AddItem b dim c as new MyCocoaMenuItemMBS c.CreateMenuItem "Next menu entry" c.Enabled=true c.Tag=2 c.state=1 items.Append c m.AddItem c dim d as new MyCocoaMenuItemMBS d.CreateMenuItem "Last menu entry" d.Enabled=false d.tag=3 items.Append d m.AddItem d e.Menu=m End EventHandler
Property Protected e As NSStatusItemMBS
Property Protected items(0) As NSMenuitemMBS
Property m As NSMenuMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class MyCocoaMenuItemMBS Inherits NSMenuItemMBS
EventHandler Sub Action() MsgBox "You chose menu item number "+str(tag) End EventHandler
End Class
Class App Inherits Application
EventHandler Sub Open() if TargetMachO=false then MsgBox "This example needs a MachO target running on Mac OS X." quit end if End EventHandler
End Class
End Project

See also:

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


💬 Ask a question or report a problem