izhar
izhar

Reputation: 91

WizardPage adjustment with change of screen resolution

I have a dialog with a wizard containing one wizard page. The wizard page appears differently for different screen resolution. Some contents of wizardpage is missed if the it is executed in laptop or desktop with different screen resolution. I have set the wizard page size in the dialog: dialog.setPageSize(700, 700); But eventhough this is not working properly. Please let me know is there any way so that wizard page gets adjusted with screen resolution changes. Thanks in advance.

Upvotes: 0

Views: 118

Answers (1)

greg-449
greg-449

Reputation: 111216

In your WizardPage you can reset the size of the dialog to match the preferred size of the contents using something like this:

private void recalcSize()
{
  Composite dialogAreaComp = (Composite)getControl();

  Shell shell = getShell();

  Point shellSize = shell.getSize();

  dialogAreaComp.layout(true, true);

  Point newSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);

  if (newSize.x != shellSize.x || newSize.y != shellSize.y)
    shell.setSize(newSize);
}

Put a call to recalcSize in the setVisible method of the page.

Upvotes: 2

Related Questions