Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » GradLayout set first two columns equal width to last two columns
GradLayout set first two columns equal width to last two columns [message #633520] Mon, 18 October 2010 10:22 Go to next message
Sebastian  is currently offline Sebastian Friend
Messages: 22
Registered: September 2010
Junior Member
Hey,

I am having the following problem:

I have a 4 column grid layout and i set the equal width property to false because the contents look like this

FirstName: | TextField | LastName: | TextField

now i don't want the label's cell to consume the same space as the text field's cell does. But I want that the first two columns consume the same space than the last two columns.

I am using this in an editor and depending which contents the controls have the sizing varies and it looks awkward if you skim thru the editors.

I tried nesting grid layouts but I get vertical alignment proplems.

Is there any decent solution to this ?

Thanks Smile
Re: GradLayout set first two columns equal width to last two columns [message #633854 is a reply to message #633520] Tue, 19 October 2010 15:39 Go to previous messageGo to next message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
Hey Sebestian,

I think what you need to do is assign a GridData object to your Text/Label objects.

so:
Composite parent = new Composite(parent2);
parent.setLayout(new GridLayout(4));

Text text = new Text(parent);
GridData data = new GridData()
data.hint(height, width);
text.setLayoutData(data)

Double check my syntax but this should solve your issue.
Re: GradLayout set first two columns equal width to last two columns [message #634401 is a reply to message #633520] Thu, 21 October 2010 14:47 Go to previous messageGo to next message
Sebastian  is currently offline Sebastian Friend
Messages: 22
Registered: September 2010
Junior Member
Hey,

thanks for your reply.

Thing is, i don't want to set hints because I want the columns to grow dynamically when the window is resized. Any idea ?
Re: GradLayout set first two columns equal width to last two columns [message #634414 is a reply to message #634401] Thu, 21 October 2010 15:33 Go to previous messageGo to next message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
Hmm I know that for tables I use TableColumnLayout and set the LayoutData to a new ColumnWeightData object with a certain pecent width. Not sure if this works for your issue.
Re: GradLayout set first two columns equal width to last two columns [message #635038 is a reply to message #634401] Mon, 25 October 2010 13:46 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
Nesting the layouts is the way to do this. The outer layout would have two
equal-width columns, then within each of these columns would be a Composite
whose layout specified two columns. What vertical layout problems is this
giving you?

Grant


"Sebastian" <hamlax@gmail.com> wrote in message
news:i9pjjc$8tk$1@news.eclipse.org...
> Hey,
> thanks for your reply.
>
> Thing is, i don't want to set hints because I want the columns to grow
> dynamically when the window is resized. Any idea ?
Previous Topic:Table Double Click another view has to Change
Next Topic:Implement an Alert View
Goto Forum:
  


Current Time: Wed Dec 17 23:09:10 GMT 2014

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

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