Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » GridLayout: marginTop and marginBottom versus marginHeight
GridLayout: marginTop and marginBottom versus marginHeight [message #451365] Sun, 27 February 2005 19:09 Go to next message
Eclipse UserFriend
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 01:09 Go to previous messageGo to next message
Eclipse UserFriend
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 #451379 is a reply to message #451366] Mon, 28 February 2005 14:09 Go to previous messageGo to next message
Eclipse UserFriend
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 14:11 Go to previous message
Eclipse UserFriend
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: Fri Jul 25 15:46:53 EDT 2025

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

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

Back to the top