Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ToolTip widget behaves inconsistently(When the message has more than one line the tooltip looks different)
ToolTip widget behaves inconsistently [message #1805268] Wed, 10 April 2019 15:22
Julia Kurde is currently offline Julia KurdeFriend
Messages: 84
Registered: November 2011
Location: Berlin, Germany
Member
Hello,
I am creating a org.eclipse.swt.widgets.ToolTip with SWT.BALLOON style and a text and a message. When the message has only one line the tooltip appears with rounded corners. When the message has more than one line (one or more line breaks) the tooltip has no rounded corners.

index.php/fa/35274/0/
index.php/fa/35275/0/

This behavior happens on Windows 10.
(The black design you see in the images has nothing to do with it)

Does anyone know why it looks like this?

This is the code to reproduce it:
package probieren.julia;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolTip;

public class ToolTipTest {
	public static void main (String [] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		FillLayout fillLayout = new FillLayout ();
		shell.setLayout (fillLayout);

		Button button0 = new Button (shell, SWT.PUSH);
		button0.setText ("Show ToolTip 1");

		Button button1 = new Button (shell, SWT.PUSH);
		button1.setText ("Show ToolTip 2");

		final ToolTip tip = new ToolTip(button0.getShell(), SWT.BALLOON);
		tip.setAutoHide(false);

		final String str1 = "Das ist die Message.";
		final String str2 = "Das ist die Message.\n...Mit zwei Zeilen...";

		button0.addListener(SWT.Selection, new Listener() {

			@Override
			public void handleEvent(Event event) {
				tip.setVisible(false);
				tip.setText("Das ist der Text");
				tip.setMessage(str1);

				tip.setVisible(true);
			}
		});
		button1.addListener(SWT.Selection, new Listener() {

			@Override
			public void handleEvent(Event event) {
				tip.setVisible(false);
				tip.setText("Das ist der Text");
				tip.setMessage(str2);

				tip.setVisible(true);
			}
		});
		shell.pack ();
		shell.open ();

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


Thanks,
Julia
  • Attachment: tooltip1.jpg
    (Size: 9.43KB, Downloaded 203 times)
  • Attachment: tooltip2.jpg
    (Size: 11.16KB, Downloaded 222 times)
Previous Topic:launching the web browser
Next Topic:Access "VSplit" system cursor (Windows)
Goto Forum:
  


Current Time: Sun Apr 05 21:37:38 GMT 2020

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

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

Back to the top