Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Shell - Cant keep it on top (Linux gtk)
Shell - Cant keep it on top (Linux gtk) [message #675408] Tue, 31 May 2011 12:36
Eclipse UserFriend
Originally posted by: Thomas Barth

I ve got a StyledText-Box with Links integrated. When clicking on a link
it opens a simple shell (like a splash) to display an image. On a Linux
System like Ubuntu Lucid it cant keep the shell on top because the
listener gets an mouse exit event as soon as the mouseup event occurs.

This is the mouse down listener for the links

txtMessages.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
try {
int offset = txtMessages.getOffsetAtLocation(new Point (event.x,

StyleRange style = txtMessages.getStyleRangeAtOffset(offset);

if (style != null && style.underline && style.underlineStyle ==

String content_id = (String);

SplashMMS splashMMS = new SplashMMS(content_id);;
} catch (IllegalArgumentException e) {

And this is the SplashMMS-Class:

public class SplashMMS {

private final Display display = MyProgram.getDisplay();
private final Shell shell = new Shell(SWT.ON_TOP);
private Image image = null;
private String content_id;

public SplashMMS(String content_id) {
this.content_id = content_id;

shell.setLayout(new GridLayout());

public void open() {

String[] image_info = HTTPRequestor.getContentInfo(content_id);
String filename = image_info[0];
String thread_id = image_info[1];

ImageData imageData = MMSLoad.requestImageData(thread_id, filename);

Label label = new Label(shell, SWT.NONE);

label.addListener (SWT.MouseEnter, new Listener () {
public void handleEvent (Event e) {
Report.print(" listener mouse enter");

label.addListener (SWT.MouseExit, new Listener () {
public void handleEvent (Event e) {

Report.print(" listener mouse exit");

if(null != image) image.dispose();

if(null != imageData) {

image = new Image(display, imageData);


} else {

label.setText("Image doesnt exist!");


I ve already checked that the x/y location of the cursor is a bit
greater than the x/y location of the shell! The cursor is on the image,
there shouldnt be an mouse exit event.
On a Windows System it works as expected. The mouse exit event occurs
when moving the cursor out of the label bounds.

Any idea how to get it work on a linux system with gtk?

Thomas B
Previous Topic:Master/Detail Form block in View?
Next Topic:Loading 32 bit IE from SWT browser widget on 64 bit machine
Goto Forum:

Current Time: Sun Dec 06 01:38:06 GMT 2020

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

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

Back to the top