Example: /MacCocoa/NSStatusItem/Statusitem Counter

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 Counter


Required plugins for this example: MBS MacCocoa Plugin, MBS MacCF 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 Counter

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

Project "Statusitem Counter.xojo_binary_project"
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 App Inherits Application
EventHandler Sub Open() dim f as FolderItem if TargetMachO=false then MsgBox "This example needs a MachO target running on Mac OS X." quit end if s=new NSStatusItemMBS if not s.Available then MsgBox "NSStatusItem not available." quit end if CountItem= new NSMenuItemMBS CountItem.CreateMenuItem "Counting..." CountItem.Enabled = true m = new NSMenuMBS m.addItem CountItem call s.CreateMenu s.HighlightMode=false s.Title="Click me" s.HighlightMode=true s.menu = m c=new clock c.Period=1000 c.mode=2 End EventHandler
Sub update() count = count + 1 CountItem.Title= str(count) // for console: System.DebugLog str(count) End Sub
Property CountItem As NSMenuItemMBS
Property c As clock
Property count As Integer
Property last As string
Property m As NSMenuMBS
Property s As NSStatusItemMBS
End Class
Class Clock Inherits CarbonEventsTimerMBS
EventHandler Sub Action() app.update 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