Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibility)
Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibility) [message #1701173] Thu, 09 July 2015 15:59 Go to next message
Andreas Sewe is currently offline Andreas SeweFriend
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. Sad

Best wishes,

Andreas
Re: Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibil [message #1701178 is a reply to message #1701173] Thu, 09 July 2015 16:25 Go to previous messageGo to next message
Eclipse UserFriend
I don't see anything obvious. I'll suggest you try loading it into WindowBuilder and try experimenting.

Have you tried clearing your runtime workspace? Just wondering if the wizard has persisted (and thus reloads) its sizing information to disk.

Brian.
Re: Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibil [message #1701180 is a reply to message #1701178] Thu, 09 July 2015 16:35 Go to previous messageGo to next message
Andreas Sewe is currently offline Andreas SeweFriend
Messages: 111
Registered: June 2013
Senior Member
Hi Brian,

thanks for your reply.

Quote:
I don't see anything obvious. I'll suggest you try loading it into WindowBuilder and try experimenting.

Have you tried clearing your runtime workspace? Just wondering if the wizard has persisted (and thus reloads) its sizing information to disk.

Even with a fresh workspace, the problem still persists.

What is surprising is that the behavior on Mac OS X and Windows is so different. Does this mean I should file a bug? (Creating a minimal example shouldn't be too hard.)
Re: Label with WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incomatibil [message #1701187 is a reply to message #1701180] Thu, 09 July 2015 17:19 Go to previous messageGo to next message
Eclipse UserFriend
It's extremely unlikely it's a bug, otherwise we'd be seeing it in all sorts of other wizards.

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.

Brian.
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 Go to previous message
Andreas Sewe is currently offline Andreas SeweFriend
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 Smile).

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.
Previous Topic:Error initializing Browser on Linux
Next Topic:Slider, Scrollbar
Goto Forum:
  


Current Time: Tue Mar 19 06:33:31 GMT 2024

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

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

Back to the top