Using MBS NSDockItemMBS to add progress bar to Dock icon?

  1. 5 months ago

    Tim J

    Jun 10 Dehydrating in AZ

    Specifically for Christian, but anyone is welcome to provide pointers :)

    I would like to add a custom progress bar to my Application's Dock Icon. I've found the NSDockIconMBS class, but can't determine how to go about drawingmy pair of 3xWidth RoundedRects into the Dock Image and then update it.

    Anyone know of an example (or a plugin, if this is outside of the NSDockIconMBS class' design)?

  2. Beatrix W

    Jun 10 Pre-Release Testers, Third Party Store Europe (Germany)

    What do you have problems with? It's quite easy to make an animation in the dock icon. I make a running number of archived mails for my app.

    -image-

    Do you want the code?

  3. James D

    Jun 10 Pre-Release Testers, Xojo Pro Europe (Switzerland)

    @Beatrix W What do you have problems with? It's quite easy to make an animation in the dock icon. I make a running number of archived mails for my app.

    -image-

    Do you want the code?

    Yes please!

  4. Christian S

    Jun 10 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    NSDockTileMBS class.

    But OverlayApplicationIconImage may be better in NSApplicationMBS class.
    Like this:

     // draw a picture with a red dot on the top left
      
      dim p as new Picture(512,512,32)
      
      dim g as Graphics = p.Graphics
      g.ForeColor = &cFF0000
      g.FillRect 0,0,128,128
      
      g = p.mask.Graphics
      
      g.ForeColor = &cFFFFFF
      g.Fillrect 0,0,512,512
      g.ForeColor = &c000000
      g.Filloval 0,0,128,128
      
      Backdrop = p
      
      // create nsimage
      dim n as new NSImageMBS(p,p.mask)
      
      // and overlay over original image
      NSApplicationMBS.sharedApplication.OverlayApplicationIconImage n
  5. Beatrix W

    Jun 10 Pre-Release Testers, Third Party Store Europe (Germany)

    Here is my project: http://www.mothsoftware.com/downloads/DockTileChanger.zip

    From the note:

    When clicking on the Start Counting button a timer is started which changes the DockTile icon and counts up. With the Reset button the DockTile is reset.
    As always with my code the MBS plugin is used.
    Code is placed in Public Domain.

    I had an additional animation working similar to an indetermined progress. But there seems to be a bug somewhere because the animation isn't showing anymore.

  6. Tim J

    Jun 10 Dehydrating in AZ

    Thanks Christian and Trixie!

    I'll attack those later this morning.

or Sign Up to reply!