Community
Participate
Working Groups
I have a fairly simple use case.. I'm using a composite with a RowLayout and putting a label and a link inside that layout. Here is the offending code: noPackagesComposite = new Composite(pageBook, SWT.NONE); noPackagesComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); new Label(noPackagesComposite, SWT.NONE).setText(PackagesUIMessages.ProjectPackagesView_noPackagesDefinedMessage); Link createPackageLink = new Link(noPackagesComposite, SWT.NONE); Viewing this in GTK2 causes the link to be cut off and only show part of the text. The link should say "Create a Package". Here is the win32 (correct) rendering: http://www.arcaner.com/pictures/screenshots/link_in_rowlayout_win32.png And here is the gtk2 (incorrect) rendering: http://www.arcaner.com/pictures/screenshots/link_in_rowlayout_gtk2.png Resizing/moving/re-initializing my view does nothing for making this "snip" go away. My initial guess is somehow the link widget is being cutoff by the RowLayout implementation, but I'm just stabbing in the dark.
It might be a bug in Link, RowLayout or computeSize(). In any case, we'll need a stand alone snippet that shows the problem or a set of steps in Eclipse.
Works for me. Please modify the snippet so that is reproduces the bug. import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class PR151322 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite noPackagesComposite = new Composite(shell, SWT.NONE); noPackagesComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); Label label = new Label(noPackagesComposite, SWT.NONE); label.setText("No packages have been defined for this project"); Link createPackageLink = new Link(noPackagesComposite, SWT.NONE); createPackageLink.setText("<a>Create a package</a>"); shell.setBounds(200, 200, 300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } --------------------- Reopen this problem if you still have the problem.
I can repro this bug by changing the text of the link to "Watch videos" When I do then the word "videos" gets dropped completely and does not appear in the link. import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class PR151322 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite noPackagesComposite = new Composite(shell, SWT.NONE); noPackagesComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); Label label = new Label(noPackagesComposite, SWT.NONE); label.setText("No packages have been defined for this project"); Link createPackageLink = new Link(noPackagesComposite, SWT.NONE); createPackageLink.setText("<a>Watch videos</a>"); shell.setBounds(200, 200, 300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Note I don't think it has anything to do with RowLayout because I am struggling with the same issue using GridLayout
Note also: If I change the link text to "watch videos" with a lower case "w" then the link is rendered correctly with no truncation so that make me think there is a probably a bug in computing the size of variable width upper/lower case characters. Can someone please reopen this? Thanks
Felipe, can you confirmt that changing the text shows the bug? If so, please reopen. Scott, don't worry about reopening a bug if you are seeing a problem. The only time reopening a bug is an issue would be if we got into some sort of revert war.
... and I reopened it.
For other folks having this issue I was able to workaround it for now by adding some whitespace to the end of the string before calling Link.setText()
Works for me (SWT=HEAD, Linux=Fedora Core 10) Can you attach a screenshot of the problem ?
I am on RH EL5 x86_64 gtk2-2.10.4-16.el5
Created attachment 130770 [details] screenshot showing the truncation of the link text
Strangely, when I use the link text of the original submitter ("Create a Package") the link rendering works fine with no truncation (i.e. I do not see the link truncation that the original submitter did). For me: "Watch videos" gets truncated "watch videos" does not Vary strange...
Note: https://bugs.eclipse.org/bugs/show_bug.cgi?id=244499 is probably a dupe of this one
*** Bug 244499 has been marked as a duplicate of this bug. ***
I can see this problem on RH EL5 (64 and 32 bits). This is rounding problem deep down in pango. I have c example that has the same problem. The same works on my Fedora 10, I believe this has being fixed in newer version of gtk/pango. The string that fails on RH EL5 has different size on fedora, so the testing is not 100% the same. But I tested with many different inputs for text and font, and the problem didn't happen at all on fedora 10 and ubuntu 8.4.
Created attachment 130878 [details] c example This example shows that the problem can happen to a simple gtk app. Feel free to use this example to report a bug against gtk. But again, I believe this is fixed already.
closing not eclipse.
See bug 393602 for follow-ups.