Add Icon Badge

Hi!

you all know this little badges containing numbers on Mac OS dock icons…
And here is the question: is it possible to add a badge to apps made with Xojo? And if yes: how? I didn’t find anything in the docs or this forum.

Thanks

MBS Plugins (?)

Exactly :slight_smile:

:slight_smile:

This is also made easy by using Macoslib. There’re functions related to NSDockTile and there’s an example usage that adds it to the example application itself.

The other option is to redo Macoslib’s or Christian’s work and do the declares yourself :slight_smile:

https://developer.apple.com/library/mac/documentation/cocoa/reference/nsdocktile_class/reference/reference.html

Don’t forget that you can draw your own

http://documentation.xojo.com/index.php/DockItem

Quick example. If you are compiling for windows and linux as well make sure you wrap the code in #if#endif.
https://www.dropbox.com/s/9aja2e4qnh8tz91/dock%20item%20text.xojo_binary_project

Hi All…

Thanks for your answers. I was hoping that there’s something possible without external libraries.
I’ve seen MBS but – sorry – the whole website looks badly outdated and I did not find any way to download or buy some stuff there. But the main show stopper for using external plugins: you don’t have any control and can’t do anything to make thinks work if Apple breaks something with an update.

Drawing own Icons breaks when you put something to an edge of an Icon and the user moves the dock to the side of the display (positioning) – and there’s no way for Xojo to detect how the dock is oriented. And most important: it’s not native.

So we have to play around with NSDockTile from within Xojo… Do you have any resource to start from?

For the website, where did you look at?

The plugin website has big download buttons:
http://www.monkeybreadsoftware.de/xojo/plugins.shtml

You can use the code from plugin or from MacOSLib. It’s your choice.

But you have to admit that the design of the Site is a bit…outdated. :wink:

why outdated? It’s a nice timeless design and I probably prefer working on the plugins than looking for a design change :slight_smile:

I was trying to avoid any external libraries, but the whole constructor-part is visible and a good point to start.

Thank you :slight_smile:

[quote=106196:@Pascal B. Kreil]I was trying to avoid any external libraries, but the whole constructor-part is visible and a good point to start.

Thank you :-)[/quote]

If it’s easier for you, Macoslib can be considered a collection of declares (it’s not a “library” as in a DLL or DYLIB, but as a collection of resources). The ones you create yourself wouldn’t be done much differently. The only way to go simpler than macoslib is to code them yourself.

MBS Plugins have the advantage that they are supported by me and you can ask questions.

@Christian: the main problem with the Monkey website is that it doesn’t have a visual hierarchy. I still don’t remember which way to go for downloads. Got a proposal: got to http://www.usertesting.com, get 5 testers and be astonished at the result.

+1

I generally hate searching the Monkeybread site. It is about as fun as reading railway schedules.

Often, I find answers faster looking in the DMG of the plugins complete with the finder search.

But the very best is to simply ask Christian by email. He very graciously and very quickly always provide a good answer.

I know I am resurrecting a very old thread, but I would like to display a badge on a ToolBar icon. Has anybody done that yet ?

@Michel Bujardet :

+1 about the website. The visual hierarchy is awful, the search is worse.

Mac? Windows? What do you mean with “badge on a ToolBar icon”? Or do you want a badge on a dock icon? If you mean the latter check out OverlayApplicationDockTileImageMBS. But use the latest version beta because there was a bug with the mask.

I did mean badge on a ToolBar icon, not on the dock. I have a “print later” icon on the ToolBar of Check Printer, and I wanted to show the number of items in the print queue.

Well. I have now simply created a canvas custom control, and use a declare to place it on the toolbar.

I should say that Xojo’s management of Retina is splendid : I did not need to change a line for it to display nicely crisp in 2x.