Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » GridLayout: marginTop and marginBottom versus marginHeight
GridLayout: marginTop and marginBottom versus marginHeight [message #451365] Mon, 28 February 2005 00:09 Go to next message
Rod Bailey is currently offline Rod BaileyFriend
Messages: 5
Registered: July 2009
Junior Member
Since 3.1 there have been four new attributes added to the GridLayout:
marginTop, marginBottom, marginLeft and marginRight. But the pre-3.1
attributes marginHeight and marginWidth still exist.

How is marginHeight distinct from marginTop and marginBottom?
How is marginWidth distinct from marginLeft and marginRight?

Looking at the source, it appears that all six attributes take part in
layout calculations, but the interpretation of the different attributes is
not made clear from the javadoc. It appears that marginHeight is added to
both marginTop and marginBottom; and that marginWidth is added to both
marginLeft and marginRight. Why complicate matters this way?

Can anyone clarify why we use six attributes to specify four margins?
Re: GridLayout: marginTop and marginBottom versus marginHeight [message #451366 is a reply to message #451365] Mon, 28 February 2005 06:09 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Rod Bailey:

I think they want to keep compatibility. In any case, this does not
hurt, and may be even good. If you want to have equal margins to left
and right, you can set just one property.

> Since 3.1 there have been four new attributes added to the GridLayout:
> marginTop, marginBottom, marginLeft and marginRight. But the pre-3.1
> attributes marginHeight and marginWidth still exist.
>
> How is marginHeight distinct from marginTop and marginBottom?
> How is marginWidth distinct from marginLeft and marginRight?
>
> Looking at the source, it appears that all six attributes take part in
> layout calculations, but the interpretation of the different attributes is
> not made clear from the javadoc. It appears that marginHeight is added to
> both marginTop and marginBottom; and that marginWidth is added to both
> marginLeft and marginRight. Why complicate matters this way?
>
> Can anyone clarify why we use six attributes to specify four margins?
>
>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Re: GridLayout: marginTop and marginBottom versus marginHeight [message #451379 is a reply to message #451366] Mon, 28 February 2005 19:09 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
margintop, marginBottom, margin Left and marginRight are used when you want
different sized margins on one side versus the other. In general
marginWidth and marginHeight are sufficient because you want the same margin
on both sides.

If you have both marginWidth and marginLeft set, then teh result will be the
sum of the two values:


marginLeft = 2;
marginRight = 4;
marginTop = 6;
marginBottom = 8;
marginLeft = marginHeight = 0;


-----------------------------------------
| | | |
| | | |
| | | |
| | | ||
|
|
|
|
|
|
|
|
|
|
----------------------------------------

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:A9lrewVHFHA.704@fairy.ao.nlmk...
> Rod Bailey:
>
> I think they want to keep compatibility. In any case, this does not
> hurt, and may be even good. If you want to have equal margins to left and
> right, you can set just one property.
>
>> Since 3.1 there have been four new attributes added to the GridLayout:
>> marginTop, marginBottom, marginLeft and marginRight. But the pre-3.1
>> attributes marginHeight and marginWidth still exist.
>>
>> How is marginHeight distinct from marginTop and marginBottom?
>> How is marginWidth distinct from marginLeft and marginRight?
>>
>> Looking at the source, it appears that all six attributes take part in
>> layout calculations, but the interpretation of the different attributes
>> is
>> not made clear from the javadoc. It appears that marginHeight is added to
>> both marginTop and marginBottom; and that marginWidth is added to both
>> marginLeft and marginRight. Why complicate matters this way?
>>
>> Can anyone clarify why we use six attributes to specify four margins?
>>
>>
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: GridLayout: marginTop and marginBottom versus marginHeight [message #451380 is a reply to message #451379] Mon, 28 February 2005 19:11 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Forget the example at the bottom -it got sent before I was done. I think an
example isn't really needed - left me know if it is.

"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cvvq9h$aj5$1@www.eclipse.org...
> margintop, marginBottom, margin Left and marginRight are used when you
> want different sized margins on one side versus the other. In general
> marginWidth and marginHeight are sufficient because you want the same
> margin on both sides.
>
> If you have both marginWidth and marginLeft set, then teh result will be
> the sum of the two values:
>
>
> marginLeft = 2;
> marginRight = 4;
> marginTop = 6;
> marginBottom = 8;
> marginLeft = marginHeight = 0;
>
>
> -----------------------------------------
> | | | |
> | | | |
> | | | |
> | | | ||
> |
> |
> |
> |
> |
> |
> |
> |
> |
> |
> ----------------------------------------
>
> "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> news:A9lrewVHFHA.704@fairy.ao.nlmk...
>> Rod Bailey:
>>
>> I think they want to keep compatibility. In any case, this does not
>> hurt, and may be even good. If you want to have equal margins to left and
>> right, you can set just one property.
>>
>>> Since 3.1 there have been four new attributes added to the GridLayout:
>>> marginTop, marginBottom, marginLeft and marginRight. But the pre-3.1
>>> attributes marginHeight and marginWidth still exist.
>>>
>>> How is marginHeight distinct from marginTop and marginBottom?
>>> How is marginWidth distinct from marginLeft and marginRight?
>>>
>>> Looking at the source, it appears that all six attributes take part in
>>> layout calculations, but the interpretation of the different attributes
>>> is
>>> not made clear from the javadoc. It appears that marginHeight is added
>>> to
>>> both marginTop and marginBottom; and that marginWidth is added to both
>>> marginLeft and marginRight. Why complicate matters this way?
>>>
>>> Can anyone clarify why we use six attributes to specify four margins?
>>>
>>>
>>
>>
>> --
>> SY, Konstantin.
>> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
>
>
Previous Topic:UI automatic test tool
Next Topic:No images in ComboViewer?
Goto Forum:
  


Current Time: Sat Sep 19 13:19:03 GMT 2020

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

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

Back to the top