Resize a wizard dialog

A quick hint, if anyone is looking for a solution.

Obviously, if you create the wizard dialog by hand, you can use WizardDialog#setPageSize( … ).
However, it is a little bit harder to find when you want to force the size of a page in a wizard created by the platform.
Typically, one of the new wizards (File > New > …).

I got this problem with a TableViewer, on which I had set a TableLayout and forced the width of my columns.
It appeared that the wizard page was not large enough and let a scroll bar in my table.
The best solution was to force the width of my wizard (which had only one page).

Size Not Forced result in the presence of a scroll bar

The solution is in fact quite simple.
Just set the size of the shell in the createControl( Composite ) method.
At the end of this method, I put

// Force the shell size
 Point size = getShell().computeSize( 510, 540 );
 getShell().setSize( size );

Size Forced: no problem

One thought on “Resize a wizard dialog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s