App.DockItem.Graphics drawing fails?

Hi Folks, I’m trying to add a progress indicator to my dock icon in macOS. I have the following code in my App.Open event:

Dim g As Graphics
g = App.DockItem.Graphics
g.ForeColor = &c53BA2800
g.PenSize =2
g.DrawRoundRect(8, 16, g.Width * .6, 8, 2, 2)
App.DockItem.UpdateNow

No errors are thrown and I can step through it in the debugger but the dock icon is never updated.

Anyone have guidance on what could be occurring or what I’m missing?

2022r1.1 on macOS Mojave

It’s just really really really tiny. Try drawing something bigger:

Dim g As Graphics
g = App.DockItem.Graphics
g.ForeColor = &cff00ff
g.PenSize =2
g.FillRoundRect(8, 16, g.Width, g.Height * 0.2, 2, 2)
App.DockItem.UpdateNow
1 Like

That’s what I just discovered - I need to treat the icon like a 1024@2 image on a new display.

:smile:

Don’t forget to add nil checks for when macOS forgets to load the dock icon.

Also there is a bug with resetting the dock icon so you need to draw the app icon yourself.

1 Like