开发者

How to force a minimum height of a JFace Wizard in Eclipse?

开发者 https://www.devze.com 2023-03-27 11:39 出处:网络
I\'m presenting a wizard (code here) that gets too low, so the content does not show completely (see screenshot below):

I'm presenting a wizard (code here) that gets too low, so the content does not show completely (see screenshot below):

How to force a minimum height of a JFace Wizard in Eclipse?

How can I force the wizard to have a minimum height?

According to the answer on this question here on StackOverflow, the wizard will be the same height as the largest wizardpage in the wizard, but my wizard obvilusly does not get resized according to at l开发者_高级运维east the content of the largest page, and I also tried to set the minimum height of the first visible wizard page with code like this in the WizardPage class:

@Override
public void createControl(Composite parent) {
  // create the composite to hold the widgets
  Composite composite =  new Composite(parent, SWT.NULL);
  composite.setSize(300, 1024); // TODO: Does this work?

  GridData gridData = new GridData(300, 1024);
  gridData.heightHint = 1024;
  gridData.minimumHeight = 1024;
  composite.setLayoutData(gridData);

... but without success so far.

Any hints?


Try to set

parent.setLayout(new GridLayout());

to your createControl() implementation of your first page.

It appears the parent you get in that method has an instance of PageContainerFillLayout as layout, not GridLayout.

If you have access to your WizardDialog, you could also call

wizardDialog.setMinimumPageSize(300, 1024)


You may need to specify a height hint for the GridData.

Alternatively, you could use a three column GridLayout and get all the rows after the first to span columns 2 and 3. I tend to use GridLayout and haven't had this problem before.


you can use this codes below:

parent.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent event) { parent.setSize(parent.computeSize(490, 320)); } });


I just had a very similar problem (on Windows): A wizard where the wizard page had no message was not shown completely. What quickly solved it for me was to just add a message with a single space in the wizard page constructor:

class Page extends WizardPage {

    Page() {
        super("page.id", "Page title", null);
        setMessage(" ");

The accepted answer did not work for me (the wizard has quite some fields).

0

精彩评论

暂无评论...
验证码 换一张
取 消