29

With the new FireMonkey cross-platform tool, how does one create a tray icon? With Delphi it used to be TTrayIcon.

The documentation has nothing, and no other questions seem to answer this. Would appreciate any idea (I can always resort to system programming per platform, but that's just if there really is no such a thing).

Etamar Laron
  • 1,172
  • 10
  • 23
  • 1
    Does osx have an equivalent to notification icon and what is it? – David Heffernan Nov 17 '11 at 18:08
  • 1
    Yes, you can read about it in Stack Overflow question http://stackoverflow.com/questions/1970876/system-tray-menu-extras-icon-in-mac-os-using-java – Etamar Laron Nov 17 '11 at 18:11
  • 1
    I've seen non Java apps use the tray icon on the Mac also, like Plex server. The tray on the Mac is upper right corner. It's possible on the platform, but I don't know about FireMonkey. NSStatusItem on Mac OS. – Marcus Adams Nov 17 '11 at 18:38
  • 1
    You must use the [NSStatusBar](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSStatusBar_Class/Reference/Reference.html#//apple_ref/doc/uid/20000247) and [NSStatusItem](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSStatusItem_Class/Reference/Reference.html#//apple_ref/doc/uid/20000248) classes – RRUZ Nov 17 '11 at 22:21
  • Thanks @RRUZ but that's not cross platform... – Etamar Laron Nov 18 '11 at 06:40
  • 3
    I know, I just post the OS X alternative to create something like the VCL TTrayIcon. As far i know there is not a cross platform Tray Icon component, but you can write your own implementing the Windows version based in the [Shell_NotifyIcon](http://msdn.microsoft.com/en-us/library/bb762159%28VS.85%29.aspx) for the Windows side and using the [NSStatusItem](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSStatusItem_Class/Reference/Reference.html#//apple_ref/doc/uid/20000248) in OSX. – RRUZ Nov 18 '11 at 06:51

2 Answers2

1

As @RRUZ mentioned you'll have to roll two different versions for Windows and OSX.

As far as the Windows version is concerned I stumbled upon an implementation (including balloon hints) at this Chinese blog post, which (except for the missing include which defines DELPHIXE3UP) works perfectly fine for me with XE5/Win8.

I'm aware this is an old question and I didn't have a look at the OSX version yet either, but the Windows version seems like a decent start.

DNR
  • 1,619
  • 2
  • 14
  • 22
1

The Apesuite component package for Firemonkey has a TTrayIcon component that works in both Windows and OS X. It's not free but it would solve your problem.

http://arcana.sivv.com/apesuite

Jason Southwell
  • 351
  • 2
  • 9