Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » size of a composite
size of a composite [message #464752] Tue, 29 November 2005 14:13 Go to next message
Eclipse UserFriend
Originally posted by: katharinas_mail.gmx.de

I'm simply trying to get the size of a composite. I tried getBounds(),
getClientArea() and getSize() but all of their ints (eg rect.width)
returns 0. Does anyone know what I'm doing wrong?

Thanks in advance.
Re: size of a composite [message #464762 is a reply to message #464752] Tue, 29 November 2005 16:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Karei,

this depends on when you are calling these functions. If you call them
before the shell is layouted, you get 0. You can only make use of these
functions when the widgets are layouted.

Hope that helped,
Friederich

Karei wrote:
> I'm simply trying to get the size of a composite. I tried getBounds(),
> getClientArea() and getSize() but all of their ints (eg rect.width)
> returns 0. Does anyone know what I'm doing wrong?
>
> Thanks in advance.


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: size of a composite [message #464766 is a reply to message #464752] Tue, 29 November 2005 17:05 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 48
Registered: July 2009
Member
give ComputeSize a try: composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)


Karei wrote:
> I'm simply trying to get the size of a composite. I tried getBounds(),
> getClientArea() and getSize() but all of their ints (eg rect.width)
> returns 0. Does anyone know what I'm doing wrong?
>
> Thanks in advance.
Re: size of a composite [message #464769 is a reply to message #464766] Tue, 29 November 2005 17:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: katharinas_mail.gmx.de

> give ComputeSize a try: composite.computeSize(SWT.DEFAULT, SWT.DEFAULT=
)

Thanks a lot, it worked!
Re: size of a composite [message #464774 is a reply to message #464769] Tue, 29 November 2005 18:05 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Calling computeSize(SWT.DEFAULT, SWT.DEFAULT) does not give you the current
size. It gives you the preferred size of the widget. Depending on your
layout, this can be quite different from the size of the widget.

If you want to do something when the widget changes size, you should add a
Resize listener (addControlListener() and handle controlResized).

"Karei" <katharinas_mail@gmx.de> wrote in message
news:op.s00jwfkdtt899o@katlab.rpl.local...
> give ComputeSize a try: composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)

Thanks a lot, it worked!
Previous Topic:Table with only 1 column
Next Topic:Rename Feature in Tree
Goto Forum:
  


Current Time: Thu Apr 25 22:43:55 GMT 2024

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

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

Back to the top