How to hide the BadgeLabel?

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

How to hide the BadgeLabel?

Post by Wolfram »

can someone tell why this code doesn't work?

Code: Select all

  App = CocoaMessage(0, 0, "NSApplication sharedApplication")
  DockTile = CocoaMessage(0, App, "dockTile")
  CocoaMessage(0, DockTile, "setBadgeLabel:$", @"Hello")
  Delay(1000)
  CocoaMessage(0, DockTile, "setShowsApplicationBadge:", #NO)
  CocoaMessage(0, DockTile, "display")
macOS Catalina 10.15.7
User avatar
Shardik
Addict
Addict
Posts: 2076
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: How to hide the BadgeLabel?

Post by Shardik »

Sorry, I don't know why setting setShowsApplicationBadge: to #NO does not work. But using the recommended way is working fine:
NSDockTile reference wrote:To clear the badge string, specify an empty string (@"") or nil.

Code: Select all

OpenWindow(0, 270, 100, 120, 70, "Test")
App = CocoaMessage(0, 0, "NSApplication sharedApplication")
DockTile = CocoaMessage(0, App, "dockTile")
CocoaMessage(0, DockTile, "setBadgeLabel:$", @"Hello")
Delay(3000)
CocoaMessage(0, DockTile, "setBadgeLabel:$", @"")

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Post Reply