TrayItem and ToolTip bug on Ubuntu [message #511244] |
Sun, 31 January 2010 18:14 |
S Messages: 2 Registered: January 2010 |
Junior Member |
|
|
Hello,
I have 2 problems with TrayItem on Ubuntu.
I make a function to create a TrayItem. When the user click on the TrayItem, it disappear. Then it's possible to recreate it, and etc..
But for each creation, destruction of the TrayIcon, a small white space is added...
The second problem is that I placed a ToolTip message juste after the TrayItem creation, and the tooltip is not placed at the right place...
There 2 problems appear only on Ubuntu.
I'm using SWT 3.6M3
Here is my code :
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.widgets.ToolTip;
import org.eclipse.swt.widgets.Shell;
public void createTray() {
final Display displayTray = new Display();
final Shell shellTray = new Shell(displayTray);
final Tray tray = displayTray.getSystemTray();
final ToolTip tipTray = new ToolTip(shellTray, SWT.BALLOON | SWT.ICON_INFORMATION);
tipTray.setText("Tray Title");
if (tray != null) {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("Tooltip Title");
item.setImage(new Image(displayTray, getClass().getResourceAsStream("/projet/icon.png")));
item.setToolTip(tipTray);
item.setVisible(true);
tipTray.setMessage("Tooltip Text...");
// Fait disparaitre l'icône lorsque on clic dessus
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
shellTray.dispose();
}
});
}else{
// Tray icon not possible
}
tipTray.setVisible(true);
while (!shellTray.isDisposed()) {
if (!displayTray.readAndDispatch())
displayTray.sleep();
}
displayTray.dispose();
}
Thanks to help me
Seb
|
|
|
Re: TrayItem and ToolTip bug on Ubuntu [message #511468 is a reply to message #511244] |
Mon, 01 February 2010 11:36 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi, please log a report with swt at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT
with all of this information. I don't currently have access to an Ubuntu to
try this on, but hopefully someone else will if there is a report for it.
Thanks!
Grant
"S" wrote in message
news:hk4ha5$ttd$1@build.eclipse.org...
> Hello,
>
> I have 2 problems with TrayItem on Ubuntu.
>
> I make a function to create a TrayItem. When the user click on the
TrayItem, it disappear. Then it's possible to recreate it, and etc..
>
> But for each creation, destruction of the TrayIcon, a small white space is
added...
>
>
> The second problem is that I placed a ToolTip message juste after the
TrayItem creation, and the tooltip is not placed at the right place...
>
> There 2 problems appear only on Ubuntu.
>
>
>
> I'm using SWT 3.6M3
>
> Here is my code :
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.graphics.Image;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.Listener;
> import org.eclipse.swt.widgets.Tray;
> import org.eclipse.swt.widgets.TrayItem;
> import org.eclipse.swt.widgets.ToolTip;
> import org.eclipse.swt.widgets.Shell;
>
> public void createTray() {
> final Display displayTray = new Display();
> final Shell shellTray = new Shell(displayTray);
> final Tray tray = displayTray.getSystemTray();
> final ToolTip tipTray = new ToolTip(shellTray, SWT.BALLOON |
SWT.ICON_INFORMATION);
> tipTray.setText("Tray Title");
>
> if (tray != null) {
> final TrayItem item = new TrayItem(tray, SWT.NONE);
> item.setToolTipText("Tooltip Title");
> item.setImage(new Image(displayTray,
getClass().getResourceAsStream("/projet/icon.png")));
> item.setToolTip(tipTray);
> item.setVisible(true);
> tipTray.setMessage("Tooltip Text...");
> // Fait disparaitre l'ic
[Updated on: Mon, 12 September 2011 16:56] by Moderator Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03281 seconds