Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Behavioural differences of redraw() between Win7 and Win10
Behavioural differences of redraw() between Win7 and Win10 [message #1734088] Fri, 03 June 2016 16:20 Go to next message
Ralf Grossklaus is currently offline Ralf GrossklausFriend
Messages: 3
Registered: October 2015
Junior Member
Hello,

I've experienced some very strange behaviour of the Hyperlink widget on Windows 10 x64 (It works fine on Windows 7 x64, haven't tested it on other platforms). Under some circumstances (which i mention below), when moving the mouse cursor over the widget, it will recieve a SWT.MouseExit event without ever getting a SWT.MouseEnter event in the first place. The following code snippet demonstrates this, when moving the cursor over the hyperlink widgets from the top to the bottom of the window:

import static com.ibm.icu.text.MessageFormat.format;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.Hyperlink;

public class HyperlinkExample {
	
    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        shell.setLayout(new GridLayout(1, false));
        
        final String[] links = new String[] {
                "Link one",
                "Link two",
                "Link three",
                "Link four",
                "Link five",
                "Link six",
                "Link seven",
                "Link eight",
                "Link nine",
                "Link ten"
        };
        for (final String linkText : links) {
            createLink(shell, linkText);
        }

        shell.pack();
        shell.open();
        
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }

    private static void createLink(Composite parent, final String text) {
    	final Hyperlink link = new Hyperlink(parent, SWT.LEFT);
    	link.setText(text);
        link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        link.setToolTipText(format("ToolTip {0}", text));
        link.addMouseTrackListener(new MouseTrackListener() {
			
			@Override
			public void mouseHover(MouseEvent e) {
			}
			
			@Override
			public void mouseExit(MouseEvent e) {
				System.out.println(format("## Link({0})->mouseExit()", text)); //$NON-NLS-1$
			}
			
			@Override
			public void mouseEnter(MouseEvent e) {
				System.out.println(format("## Link({0})->mouseEnter()", text)); //$NON-NLS-1$
			}
		});
    }
}



I know, AbstractHyperlink is a custom widget and is not part of SWT, however the problem (as i found out) is not in the widget itself, but in the implementation of Control.redraw(false) which directs to the native implementation of OS.RedrawWindow(). This method is called on SWT.MouseExit of a Hyperlink (see AbstractHyperlink.handleExit()) and after calling this, the SWT.MouseEnter event is somehow lost. Another thing i found out is, that this fails only if a tool tip is set to the hyperlink.

Does anybody who is a bit more familiar to the windows implementation of SWT know what's the actual problem here?

Regards,
Ralf
Re: Behavioural differences of redraw() between Win7 and Win10 [message #1734208 is a reply to message #1734088] Mon, 06 June 2016 08:26 Go to previous message
Ralf Grossklaus is currently offline Ralf GrossklausFriend
Messages: 3
Registered: October 2015
Junior Member
I filed a bug for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=495473

Ralf
Previous Topic:How to create scrollcomposite for only one tabItem
Next Topic:If SWT support linux + sparc64
Goto Forum:
  


Current Time: Wed Dec 13 11:27:54 GMT 2017

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

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