Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » size of a composite
size of a composite [message #464752] Tue, 29 November 2005 09: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 11: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 12:05 Go to previous messageGo to next message
Eclipse UserFriend
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 12: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 13:05 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:43:35 EDT 2025

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

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

Back to the top