Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Implementing a proper layout for wizard pages
Implementing a proper layout for wizard pages [message #329662] Tue, 01 July 2008 02:08 Go to next message
Eclipse UserFriend
Hi,

currently, I am experimenting with the layout of some wizard pages I've
created for an application I am currently working on.

As to find some kind of "best practise", I've come across the following:

I've got a wizard page containing an explanatory text (Label) that
occupies several lines. In the past, I've solved this by inserting
"hard" line breaks (\n) into the string. However, this is not a very
elegant approach, as of course this label won't adapt its size when the
wizard dialog is resized.

A better solution would be to use a Label that has the SWT.WRAP style
set, and to set a GridData that grabs the available space and fills its
cell as to make the Label automatically adapt its size to the dialog.
This works fine on Linux-Gtk; however, on win32 it does not - the label
stretches the entire dialog.

So, I've got two questions concerning this:

1. What is the difference in the described behaviour based on?
Obviously, gtk takes another "reference" for laying out the dialog and
determining its width than win32 does.

2. What would be a proper solution to this? Setting a width hint? If so,
where? Wizard dialog, wizard page, label?

(Actually, the same applies to PreferencePages; see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=107064)

Best wishes,
Karsten

--
PGP Public Key ID 0x708CD1FE (pgpkeys.pca.dfn.de)
"When the light of day is dead, the spark of night ignites"
Re: Implementing a proper layout for wizard pages [message #329703 is a reply to message #329662] Tue, 01 July 2008 09:22 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Note: I'm copying this thread to the SWT newsgroup.

Whenever I have trouble with string-oriented widgets (Text and Label)
wanting to stretch their containers, I've found two approaches that
usually help:

A) If using a GridLayout, I set the widget's GridData to expand
horizontally *and* its width hint to 1. This forces its "preferred" size
to be just 1 pixel (which prevents it from stretching the container) and
yet forces it to fill available space.

B) Switch to a different layout that will properly use the SWT.WRAP
style, such as TableWrapLayout, FillLayout, etc. It is always good to
remember that there are other worlds than just GridLayout ;-)

Hope this helps,
Eric


Karsten Stöckmann wrote:
> Hi,
>
> currently, I am experimenting with the layout of some wizard pages I've
> created for an application I am currently working on.
>
> As to find some kind of "best practise", I've come across the following:
>
> I've got a wizard page containing an explanatory text (Label) that
> occupies several lines. In the past, I've solved this by inserting
> "hard" line breaks (\n) into the string. However, this is not a very
> elegant approach, as of course this label won't adapt its size when the
> wizard dialog is resized.
>
> A better solution would be to use a Label that has the SWT.WRAP style
> set, and to set a GridData that grabs the available space and fills its
> cell as to make the Label automatically adapt its size to the dialog.
> This works fine on Linux-Gtk; however, on win32 it does not - the label
> stretches the entire dialog.
>
> So, I've got two questions concerning this:
>
> 1. What is the difference in the described behaviour based on?
> Obviously, gtk takes another "reference" for laying out the dialog and
> determining its width than win32 does.
>
> 2. What would be a proper solution to this? Setting a width hint? If so,
> where? Wizard dialog, wizard page, label?
>
> (Actually, the same applies to PreferencePages; see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=107064)
>
> Best wishes,
> Karsten
>
Previous Topic:Previous Versions of Eclipse and Plugins
Next Topic:Presentations API
Goto Forum:
  


Current Time: Wed May 07 09:36:49 EDT 2025

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

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

Back to the top