Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How get width and height of a part
How get width and height of a part [message #755451] Tue, 08 November 2011 14:57 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
Hi,

How get width and height of a part ?

Thx
Re: How get width and height of a part [message #755727 is a reply to message #755451] Wed, 09 November 2011 11:51 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
From its parent composite? That won't include part trim etc.
Re: How get width and height of a part [message #755740 is a reply to message #755727] Wed, 09 November 2011 12:39 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
I tried from parent composite, but with and height are always 0.
It seems SWT design. We can't obtain width and heigh of a swt window (a try of OS.getWindowRect return bad result too). Part / e4 is generated with SWT renderer
so i have no solution to obtain theses informations.

You probably ask me why i need theses informations :
I reparent a native windows application in my part and want to maximize the windows with the size of the part. I do it with a moveWindow (i tried a showWindow but it failed after reparenting in the SWT window).




Re: How get width and height of a part [message #755744 is a reply to message #755740] Wed, 09 November 2011 12:58 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I think you are simply asking the size at a time to compsite is not
layouted hence it's height/width is null.

You need to install a ControlListener on the composite and then you get
informed when composite changes it size.

Tom

Am 09.11.11 13:39, schrieb jyl:
> I tried from parent composite, but with and height are always 0.
> It seems SWT design. We can't obtain width and heigh of a swt window (a
> try of OS.getWindowRect return bad result too). Part / e4 is generated
> with SWT renderer
> so i have no solution to obtain theses informations.
>
> You probably ask me why i need theses informations :
> I reparent a native windows application in my part and want to maximize
> the windows with the size of the part. I do it with a moveWindow (i
> tried a showWindow but it failed after reparenting in the SWT window).
>
>
>
>
>
Re: How get width and height of a part [message #755768 is a reply to message #755744] Wed, 09 November 2011 14:25 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
Ok,yes it's the reason.

My view part is executed. I do createProcess and reparent code in a @PostConstruct method.
I call size methods after. It seems it's too early in the lifecycle to use size methods.

So i can use swt event from my parent composite but is there annotation in e4 to use to be sure composite is layouted.

@after...???
ViewPart.method() {
...
}

Thanks

Re: How get width and height of a part [message #755775 is a reply to message #755768] Wed, 09 November 2011 14:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
No there's no (you could give @Focus a try which might be called after
the intial layout has been done) - and because the size can change you
always have to adjust not?

Tom

Am 09.11.11 15:25, schrieb jyl:
> Ok,yes it's the reason.
>
> My view part is executed. I do createProcess and reparent code in a
> @PostConstruct method. I call size methods after. It seems it's too
> early in the lifecycle to use size methods.
> So i can use swt event from my parent composite but is there annotation
> in e4 to use to be sure composite is layouted.
>
> @after...???
> ViewPart.method() {
> ..
> }
>
> Thanks
>
>
Re: How get width and height of a part [message #755801 is a reply to message #755775] Wed, 09 November 2011 16:07 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
Ok for precisions
In my use case, the good solution is in fact to use ControlListener
Thanks
Previous Topic:Css with Forms
Next Topic:Problems migrating GEF application to e4
Goto Forum:
  


Current Time: Thu Apr 25 06:38:31 GMT 2024

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

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

Back to the top