Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to fill and center using GridData
How to fill and center using GridData [message #98418] Tue, 15 July 2008 12:24 Go to next message
Eclipse UserFriend
Hi,

I would like to center a composite and to fill it (i.e. to grab excess
space).

From my point of view, it should be defined like that :
new GridData(int,SWT.CENTER,boolean,true)
but the grab seems to do not work...
Apparently, the grab or fill (what's the difference ?) only works with
new GridData(int,SWT.FILL,boolean,true)
but the SWT.FILL aligns my composite in the top

new GridData(int,SWT.FILL|SWT.CENTER,boolean,true) doesn't work better...

Any ideas ?

Thanks !

Emmanuel
Re: How to fill and center using GridData [message #98496 is a reply to message #98418] Tue, 15 July 2008 13:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Emmanuel,

not sure what you mean with "center a composite and to fill it".

Cheers,
Rüdiger

Emmanuel wrote:
> Hi,
>
> I would like to center a composite and to fill it (i.e. to grab excess
> space).
>
> From my point of view, it should be defined like that :
> new GridData(int,SWT.CENTER,boolean,true)
> but the grab seems to do not work...
> Apparently, the grab or fill (what's the difference ?) only works with
> new GridData(int,SWT.FILL,boolean,true)
> but the SWT.FILL aligns my composite in the top
>
> new GridData(int,SWT.FILL|SWT.CENTER,boolean,true) doesn't work better...
>
> Any ideas ?
>
> Thanks !
>
> Emmanuel
>
Re: How to fill and center using GridData [message #98582 is a reply to message #98496] Wed, 16 July 2008 03:41 Go to previous messageGo to next message
Eclipse UserFriend
Ok I was a bit confused...

Consider a gridlayout containing two cells in the same row. The first one
contains the highest composite (determining the height of the row). The
second cell contains a Label with a background color.

I would like to fill the cell so that the background color of my label
will cover all the cell BUT I also would like to have the text centered
vertically in the cell...

Maybe I could achieve that giving a "VERTICAL_CENTER" style to Label (No
idea how to do that !)

I hope that it's clearer...

Emmanuel
Re: How to fill and center using GridData [message #98598 is a reply to message #98582] Wed, 16 July 2008 03:47 Go to previous messageGo to next message
Eclipse UserFriend
You may put a composite which in turn contains your label. Then you can
set the background color of that composite.

Emmanuel wrote:
> I would like to fill the cell so that the background color of my label
> will cover all the cell BUT I also would like to have the text centered
> vertically in the cell...
Re: How to fill and center using GridData [message #98613 is a reply to message #98598] Wed, 16 July 2008 03:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I've forgotten to say that I would like to minimize the use of
intermediate composite. The creation of composites is still very slow in
RAP and some of my gridlayouts contain hundreds of cells...

The idea should be to achieve that with only one composite...
Re: How to fill and center using GridData [message #99361 is a reply to message #98613] Tue, 22 July 2008 08:40 Go to previous messageGo to next message
Eclipse UserFriend
Any idea how I can center vertically the text in a Label ?
Re: How to fill and center using GridData [message #99391 is a reply to message #99361] Tue, 22 July 2008 09:59 Go to previous message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi Emmanuel,

Emmanuel wrote:
> Any idea how I can center vertically the text in a Label ?
>

as far as I know, it is not possible to center the contents of a Label
vertically. Reducing the number of composites is surely a good idea. But
in this case, this seems to be the only way.

If you're looking for SWT tricks, you might get more answers on the SWT
newsgroup.

Best regards, Ralf
Previous Topic:1.1.1 I-Build
Next Topic:DateTime/Calendar
Goto Forum:
  


Current Time: Sun Jul 27 11:26:14 EDT 2025

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

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

Back to the top