Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 85328

Summary: Tooltips on a Canvas always displayed outside of the control
Product: [Eclipse Project] Platform Reporter: Billy Biggs <billy.biggs>
Component: SWTAssignee: Steve Northover <snorthov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, snorthov, trevor.campbell
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description Billy Biggs CLA 2005-02-15 16:15:39 EST
Run the following code.  The tooltip is always displayed outside of the widget,
even if this is really far away from where the cursor is.  On Windows, the
tooltip is always displayed near the mouse location.

This is not really a bug in GTK+, as this is the intended behaviour given how
tooltips are used on toolbars and other buttons in GTK+.  However, this probably
is not correct for Canvas.  Also see this GTK+ bug:

  http://bugzilla.gnome.org/show_bug.cgi?id=62174

public static void main(String [] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    Canvas canvas = new Canvas(shell, SWT.NONE);
    canvas.setToolTipText("This is a tooltip");
    shell.open();
    while(!shell.isDisposed()) {
        if(!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
}
Comment 1 Steve Northover CLA 2005-02-16 12:08:51 EST
Billy, how do you want to address this?  What about the hack to move the 
widget when it is shown?
Comment 2 Billy Biggs CLA 2005-04-03 20:53:51 EDT
*** Bug 90125 has been marked as a duplicate of this bug. ***
Comment 3 Silenio Quarti CLA 2006-02-01 14:15:18 EST
Steve, haven't you fixed this?
Comment 4 Steve Northover CLA 2006-02-01 14:18:13 EST
Fixed > 20060201
Comment 5 Steve Northover CLA 2006-02-01 14:18:22 EST
FIXED
Comment 6 trevor campbell CLA 2006-02-23 23:10:28 EST
Great work.  I've tested this now and it works mostly as expected.

There is a small glitch which is probaly not worth doing anything about, but when the tooltip text is changed from one value to another there is a flicker as the tooltip jumps to the base of the composite and is then immediatly repositioned.

There is probably a simple workaround of setting the tooltip to null and then to the new value, although I have not tried this yet.
Comment 7 Steve Northover CLA 2006-02-24 09:54:23 EST
FH is working in this area and may be able to fix this.
Comment 8 trevor campbell CLA 2006-03-01 04:10:20 EST
I have now tested "a simple workaround of setting the tooltip to null and then
to the new value".

This worked fine.  
(I aplogise it took so long,  but this is not for work but for fun and there is always to much to do)
Comment 9 Steve Northover CLA 2006-03-01 09:35:02 EST
FH, can you see the flicker that Trevor is talking about?  If Trevor can work around it outside of SWT, we should be able to fix it within the toolkit.