Author Topic: Put Application Icon on Dock to bouncing  (Read 2565 times)


  • New Member
  • *
  • Posts: 38
Put Application Icon on Dock to bouncing
« on: January 31, 2013, 08:51:39 pm »
I'm trying put my application icon to bounce, to notify user about a atention to my application (notification about update on some thing).

Have any way to made this using Lazarus? My target OS is OS X 10.7.

Thanks any help.


  • Sr. Member
  • ****
  • Posts: 425
Re: Put Application Icon on Dock to bouncing
« Reply #1 on: July 10, 2013, 12:40:38 pm »
add this to your uses
Code: [Select]
{$IFDEF DARWIN}MacOSAll, appkit,{$ENDIF}
on form creation put this:
Code: [Select]
    {$IFDEF LCLCarbon}
    NsApp := NSApplication.sharedApplication;

when you need to make the icon bounce use this for bounce the icon once
Code: [Select]
      {$IFDEF LCLCarbon}
      FRequestUserAttentionID := NSApp.requestUserAttention(NSInformationalRequest);
or this to bounce icon untill application is activated
Code: [Select]
      {$IFDEF LCLCarbon}
      FRequestUserAttentionID := NSApp.requestUserAttention(NSCriticalRequest);
if you need you can use the FRequestUserAttentionID identifier (it's an integer) to deactivate the bouncing
Code: [Select]
      {$IFDEF LCLCarbon}

p.s you can't bounce icon if your application is active (it has 'focus')
p.p.s. i'm using $IFDEF to be prepared to compile this code also on other platforms.
« Last Edit: July 10, 2013, 12:42:53 pm by Shebuka »


  • Hero Member
  • *****
  • Posts: 607
    • Tweaking4All
Re: Put Application Icon on Dock to bouncing
« Reply #2 on: April 23, 2019, 12:48:16 pm »

I realize this is an old post, but it's been a super helpful one to me.
Since there have been a few changes in the past 6 years;

You'll need to switch mode:
Code: [Select]
{$modeswitch ObjectiveC1}

Code: [Select]
{$IFDEF DARWIN} ,MacOSAll, CocoaAll {$ENDIF}

And of course swap
Code: [Select]
{$IFDEF LCLCarbon}with
Code: [Select]

The rest works still today. :)


TinyPortal © 2005-2018