TrayIcon Redraw? [message #666412] |
Wed, 20 April 2011 07:24  |
Eclipse User |
|
|
|
Hi,
I'm trying to write a little program that uses a TrayIcon. I want to change the image there when something happens.
I assign a new image to it though, and the icon doesn't update or redraw. The only way I can get it to do so is to mouse over, which defeats the whole object.
I tried disposing and instantiating a new TrayIcon, that doesn't work either.
This is on Win32 by the way.
Is this a bug? Should I be calling some extra method? (I've tried setVisible as well).
|
|
|
Re: TrayIcon Redraw? [message #666608 is a reply to message #666412] |
Thu, 21 April 2011 06:01   |
Eclipse User |
|
|
|
Hi,
There is no TrayIcon class in SWT, did you mean TrayItem?
Updating the tray item's image works fine for me on Windows XP. Here is an example snippet of TrayItem -> Snippet143.java
I tried to change the image by using this code in the above snippet, and it works fine. Does it work for you?
shell.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
item.setImage(display.getSystemImage(SWT.ICON_ERROR));
}
});
|
|
|
|
|
|
|
|
|
|
Re: TrayIcon Redraw? [message #666652 is a reply to message #666644] |
Thu, 21 April 2011 08:50  |
Eclipse User |
|
|
|
and one more not you can use Display#timerExec so avoid all the thread
syncing stuff.
Am 21.04.11 14:40, schrieb gareth.foster@thomsonreuters.com:
> I tried doing the update from there, it blew up moaning about accessing
> SWT widgets from outside the main thread. I thought I'd read this wasn't
> allowed?
|
|
|
Powered by
FUDForum. Page generated in 0.08316 seconds