|
Re: Equally sized widgets [message #465150 is a reply to message #465148] |
Tue, 06 December 2005 22:17 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Try FillLayout instead (set its fillayout.type = FillLayout.VERTICAL).
This will make them all the same size, they will as wide as the widest
one and as tall as the tallest one.
Marian Schedenig wrote:
> I have several windows/shells which contain several similar components
> aligned vertically in a one-line GridLayout. Currently, the dimensions of
> these widgets depend on their contents (in my case, they're all composites
> containing a table and two buttons, with very different contents for the
> tables). For example, if two tables are empty and the third one contains a
> long list, the first two widgets get so small that the buttons disappear.
>
> What I'd need is a way to assign weights to the widgets so that all three
> widgets always have the same height. (I can't use fixed sizes as I'm
> working on a 1920x1200 GTK system with the targets being Windows systems
> with 800x600 or 1024x768 resolutions).
>
> Any ideas are welcome.
>
> Thx,
> Marian.
>
--
Thanks,
Rich Kulp
|
|
|
|
|
|
|
|
Re: Equally sized widgets [message #465301 is a reply to message #465299] |
Thu, 08 December 2005 17:41 |
Daniel Spiewak Messages: 263 Registered: July 2009 |
Senior Member |
|
|
GridData#grabVerticalSpace
GridData#verticalAlignment = SWT.FILL
That should give you equal heights if you assign that to every widget in the row. If it's different rows, then you'll have to do:
GridData#verticalHint = height // or heightHint? can't remember
Then you'll have to override the computeSize(int, int, boolean) method in each widget (make sure you override checkSubclass() to return true as well) and have it return the height hint as Point#y if i the height hint is not SWT.DEFAULT. Point#x should be the value of super.computeSize(int, int, boolean).x and if the value of heightHint is SWT.DEFAULT, then Point#y should be the value of super.computeSize(int, int, boolean).y
Sorry about the verbose psuedo code, I didn't want to take the time to actually develop a full fledged demo. Any help?
|
|
|
Re: Equally sized widgets [message #465365 is a reply to message #465301] |
Sat, 10 December 2005 14:56 |
Marian Schedenig Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Daniel Spiewak wrote:
> If it's different rows, then you'll have to do:
Yes, that's what I want, perhaps I didn't explain properly.
> GridData#verticalHint = height // or heightHint? can't remember
>
> Then you'll have to override the computeSize(int, int, boolean) method in
> each widget (make sure you override checkSubclass() to return true as
> well) and have it return the height hint as Point#y if i the height hint
> is not SWT.DEFAULT.
That would give me fixed heights, specified in pixels. What I want is
different heights equally derived from the window height (also because I'm
coding on a very different system from the target system, so pixel heights
would probably cause trouble, aside from the fact that I generally dislike
fixed-size windows).
I guess I should simply look either into FormLayout or derive my own
GridLayout class which supports relative weights ala Swing's GridLayout.
Thanks for your detailed explanation though. :)
Marian.
--
Hofstadter's law: "It always takes longer than you think, even when you take
account of Hofstadter's law".
|
|
|
|
Powered by
FUDForum. Page generated in 0.04119 seconds