http://documentation.xojo.com/index.php/Application.DockItem
for the toolbar you could simply change the icon for the toolbar item and add a badge to the picture.
I know this is OS X channel, but these also exists on WIndows (copy more than one file in the Explorer and you will get the number of files).
For archive sake; here’s how to set the badge on the dock icon using declares.
[code]Public Sub dockBadgeLabel(assigns value as string)
#if targetmacOS then
// — Code created by Sam Rowlands - Ohanaware.com
declare function NSClassFromString lib "Foundation" ( ClassName as CFStringRef ) as integer
declare function sharedApplication lib "AppKit" selector "sharedApplication" ( classRef as integer ) as integer
declare function getDockTile lib "AppKit" selector "dockTile" ( NSApplicationInstance as integer ) as integer
declare sub setBadgeLabel lib "AppKit" selector "setBadgeLabel:" ( NSDockTileInstance as integer, NSStringValue as CFStringRef )
setBadgeLabel( getDockTile( sharedApplication( NSClassFromString( "NSApplication" ) ) ), value )
#endif
End Sub[/code]
Then simply use code like below.
dockBadgeLabel = "Testing"
Edit: This will give you consistent badges on your application icons within the macOS Dock.