TrayItem - Position Information!

Hi

I’m adding a trayitem to both Windows/Linux Mint. Anyone have any ideas how to extract the position of the generated trayitem? I want to throw a window on the screen in a position relative to the trayitem.

BTW - trayitem doesn’t seem to work on Ubuntu, anyone else seen this?

Thanks

http://msdn.microsoft.com/en-us/library/bb776822(VS.85).aspx

Interesting article discussing the logic :
http://www.codeproject.com/Articles/3694/CTrayIconPosition-where-is-my-tray-icon

About Linux, I suspected since the GUI differs between pure X11, KDE, Gnome and Unity, things may be a lot messier than plain and simple msdn for Windows.

It seems indeed to be the case, according to that discussion :
http://www.blitzbasic.com/Community/posts.php?topic=43860

Yet there are there interesting links to the various APIs.

XLib could be the langua franca, but it is a C library and I have no idea how this could be addressed from Xojo :
http://stackoverflow.com/questions/12717138/what-is-linux-s-native-gui-api/12717284#12717284

Thanks for the info Michel - I have some reading to do!

Hi Patrick,

Is the MonkeyBreadSoftware Tray Item plugin any good for your needs on Windows -
https://www.monkeybreadsoftware.net/class-windowssystemtraymbs.shtml
I am using it to display info in bubbles.

Paul

For Linux, I just found some possible ways. The LR mentions the Linux TrayItem is using GtkStatusIcon so I searched for it, and found a treasure of documentation for it at https://developer.gnome.org/gtk3/stable/GtkStatusIcon.html

In particular, gtk_status_icon_get_geometry () seems to be exactly what you need. It is mentioned as deprecated, but since there is nothing else…

To build Linux declares, thankfully Christian Schmitz of Monkeybreadsoftware has posted the only example I know of at
http://www.monkeybreadsoftware.net/example-util-softdeclares-softdeclarelinux.shtml

There is another way that can work well. Since the tray icon will appear as the last one when you launch the app, all is needed is to detect it into the task bar. Use ScreenShotRectMBS to get the pixel color of the taskbar on the right hand side, and scan to the left until a color change. That will be where the icon right hand side is.

Interestingly enough, this method will also work on Windows.

I have used successfully a similar method on Mac with the same plugin, to detect the position of the dock that I could not find with declares.