Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibility) [message #1701173] |
Thu, 09 July 2015 15:59 |
Andreas Sewe Messages: 111 Registered: June 2013 |
Senior Member |
|
|
Hi all,
I am currently struggling with the following simple wizard page, which behaves different under Mac OS X and Windows, respectively:
public class ExampleWizardPage extends WizardPage {
public ExampleWizardPage() {
super("ExampleWizardPage");
setTitle("Title");
setDescription("Description");
}
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(container);
Label label = new Label(container, SWT.WRAP);
label.setText("Some very, very, very loooooong label which should wrap");
GridDataFactory.fillDefaults().grab(true, false)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
.applyTo(label);
Dialog.applyDialogFont(container);
setControl(container);
}
}
On Mac OS X, my wizard (with just has this single page) has the default width and height. Also, the label wraps as desired.
On Windows 7, the label wraps and my wizard has the standard width but its height is as large as the screen allows, even though the label should just grab horizontal space, not vertical.
Any attempt so far to fix this (making the label not grab space, removing the width hint) resulted in the label not wrapping any more, which is also not an option.
Any suggestions on how to fix this? This Mac/Windows incompatibiliy has cost me half a day already and now I am out of ideas.
Best wishes,
Andreas
|
|
|
|
|
|
Re: Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibil [message #1701241 is a reply to message #1701187] |
Fri, 10 July 2015 08:02 |
Andreas Sewe Messages: 111 Registered: June 2013 |
Senior Member |
|
|
Quote:It's extremely unlikely it's a bug, otherwise we'd be seeing it in all sorts of other wizards.
I have found the problem:
GridDataFactory.fillDefaults().grab(true, false)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
.applyTo(label);
The problem is the vertical SWT.FILL implied by fillDefaults. Adding an explicit align(SWT.FILL, SWT.BEGINNING) fixes the issue. The wizard page is now only as high as it should be.
That being said, I do find it odd that the same code produces vastly different looks under Windows and OS X. Being a few pixels here and there to match OS conventions is perfectly fine (works as designed), but one page being as high as the display would allow surprised me. So, yes, I would call this a bug (although I have found a workaround now ).
Quote:But sure, put together a small self-contained application. I can't promise I'll have time to look at it, but someone else here might.
Maybe I have time to through together a full-fledged example over the weekend... Right now I am just glad that I found out what I did wrong.
|
|
|
Powered by
FUDForum. Page generated in 0.04550 seconds