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 09:57 Go to next message
jyl is currently offline jyl
Messages: 8
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 06:51 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
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 07:39 Go to previous messageGo to next message
jyl is currently offline jyl
Messages: 8
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 07:58 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5242
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 09:25 Go to previous messageGo to next message
jyl is currently offline jyl
Messages: 8
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 09:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5242
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 11:07 Go to previous message
jyl is currently offline jyl
Messages: 8
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: Fri Jul 25 07:32:31 EDT 2014

Powered by FUDForum. Page generated in 0.02384 seconds