Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using layouts with complex widgets like tables or trees and computeSize()
Using layouts with complex widgets like tables or trees and computeSize() [message #451948] Fri, 11 March 2005 11:08 Go to next message
Eclipse UserFriend
I've had a consistent problem when using a GridLayout (and other layouts)
when using mutliple tree/table widgets. The problem occurs when I ask both
widgets to take up available space (whether horizontal or vertical space).
The problem is the widgets are sized in relation to their contents. For
example, I have two tables layed out one on top of the other, with both
given GridData.FILL_BOTH. Initially both are sized equally because they
have no contents. Subsequently, if I add items to one table, then cause the
layout to be recalculated (on a resize for example), then the table with the
items can take up a large amount of space, even essentially hiding the other
table.

This is not how I would intuitively want the GridLayout to work. Complex
'containing' widgets like Tables, Trees and Lists I would expect not to size
relative to their contents. Is there a way to tell the layout, not to ask
for the preferred sizing of certain widgets? Is there any way to alter this
behavior? Am I the only one to encounter this?

-Chris
Re: Using layouts with complex widgets like tables or trees and computeSize() [message #451949 is a reply to message #451948] Fri, 11 March 2005 11:13 Go to previous message
Eclipse UserFriend
Yes. You can set a widthHint or a heightHint. This hint overrides what
would normally be calculated with computeSize. You can still make the
widget grow larger or smaller than this value using FILL_BOTH.

"Chris" <schtoo@schtoo.com> wrote in message
news:d0sfqk$1vk$1@www.eclipse.org...
> I've had a consistent problem when using a GridLayout (and other layouts)
> when using mutliple tree/table widgets. The problem occurs when I ask
> both widgets to take up available space (whether horizontal or vertical
> space). The problem is the widgets are sized in relation to their
> contents. For example, I have two tables layed out one on top of the
> other, with both given GridData.FILL_BOTH. Initially both are sized
> equally because they have no contents. Subsequently, if I add items to
> one table, then cause the layout to be recalculated (on a resize for
> example), then the table with the items can take up a large amount of
> space, even essentially hiding the other table.
>
> This is not how I would intuitively want the GridLayout to work. Complex
> 'containing' widgets like Tables, Trees and Lists I would expect not to
> size relative to their contents. Is there a way to tell the layout, not
> to ask for the preferred sizing of certain widgets? Is there any way to
> alter this behavior? Am I the only one to encounter this?
>
> -Chris
>
Previous Topic:cursor set incorrectly for JSplitPane with SWT embedded swing
Next Topic:Issues with tablecolumn header
Goto Forum:
  


Current Time: Sun Jul 06 09:17:20 EDT 2025

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

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

Back to the top