简体   繁体   English

SWT托盘图标弹出窗口

[英]SWT Tray Icon Popup

I'm playing with a Tray and TrayItem in SWT, and i was wondering if there was a way of getting the location on screen of the icon. 我正在使用SWT中的Tray和TrayItem进行游戏,我想知道是否有一种方法可以在图标的屏幕上获取位置。 I want to be able to position another shell just underneath it as if it were a popup. 我希望能够将另一个外壳放置在其下方,就像是弹出窗口一样。

Basicaly just having a mare trying to find the dimensions and location of it.... 基本上,只有母马试图找到它的尺寸和位置。

Any ideas? 有任何想法吗?

Cheers 干杯

Andy 安迪

Why would you need this? 你为什么需要这个?

If the trigger for displaying the pop-up is a mouse click, you can use the Event object of the listener to get the co-ordinates. 如果显示弹出窗口的触发器是单击鼠标,则可以使用侦听器的事件对象来获取坐标。

If not, I don't think its a good idea to do this. 如果没有,我认为这样做不是一个好主意。 Mainly because you never know whether a tray icon will be visible or not (in Windows 7 for example). 主要是因为您永远不知道任务栏图标是否可见(例如,在Windows 7中)。 If you are using Gnome, you can use libNotify, which is a much better choice for pop-ups. 如果使用的是Gnome,则可以使用libNotify,这对于弹出式窗口来说是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM