ToolTip widget behaves inconsistently [message #1805268] |
Wed, 10 April 2019 11:22 |
Eclipse User |
|
|
|
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.


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 515 times)
Attachment: tooltip2.jpg
(Size: 11.16KB, Downloaded 550 times)
|
|
|
Powered by
FUDForum. Page generated in 0.06992 seconds