Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TrayItem and ToolTip bug on Ubuntu
icon11.gif  TrayItem and ToolTip bug on Ubuntu [message #511244] Sun, 31 January 2010 18:14 Go to next message
S is currently offline 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.

http://seb33300.free.fr/tray.jpg

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 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
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

Re: TrayItem and ToolTip bug on Ubuntu [message #511520 is a reply to message #511244] Mon, 01 February 2010 21:03 Go to previous message
S is currently offline S
Messages: 2
Registered: January 2010
Junior Member
I tried the new 3.6M5 version and it's the same.

Bug reported here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=301461
Previous Topic:ExpandBar how multiline Label layout
Next Topic:Unlogical layouting
Goto Forum:
  


Current Time: Thu Oct 30 23:52:55 GMT 2014

Powered by FUDForum. Page generated in 0.01777 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software