Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » New window on different screen(when main window is on other screen than primary)
New window on different screen [message #1698855] Thu, 18 June 2015 12:31 Go to next message
Bartlomiej Cichocki is currently offline Bartlomiej CichockiFriend
Messages: 23
Registered: April 2015
Junior Member
Hello,
I run application on second screen (or I move it to second screen), then I want to open second window
MWindow window = modelSrv.createModelElement( MWindow.class );
window.getPersistedState().put( "efx.window.stagemodality", Modality.APPLICATION_MODAL.toString() );
MPart part = partSrv.createPart( TEST54_APP_PARTDESCRIPTOR_0 );
window.getChildren().add( part );
window.setWidth( 200 );
window.setHeight( 200 );
app.getChildren().add( window );
Unfortunetally second window will be appear on primary window - but parent window is on second screen.
Whether it is intentional? Or should be appear on screen, where parent window is?
Re: New window on different screen [message #1698872 is a reply to message #1698855] Thu, 18 June 2015 13:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You are adding the window to the application, so you get a secondary top
level window who has no parent window! If the new window should be a
child of the first you need to add it to the parents windows child list.

In general you are responsible for the location of the window by default
it will be opened at 0/0 so if you want to at a different location you
need to set the x/y coordinates appropriately!

Tom

On 18.06.15 14:31, Bartlomiej Cichocki wrote:
> Hello,
> I run application on second screen (or I move it to second screen), then
> I want to open second window
> MWindow window = modelSrv.createModelElement( MWindow.class );
> window.getPersistedState().put( "efx.window.stagemodality",
> Modality.APPLICATION_MODAL.toString() );
> MPart part = partSrv.createPart( TEST54_APP_PARTDESCRIPTOR_0 );
> window.getChildren().add( part );
> window.setWidth( 200 );
> window.setHeight( 200 );
> app.getChildren().add( window );Unfortunetally second window will be
> appear on primary window - but parent window is on second screen.
> Whether it is intentional? Or should be appear on screen, where parent
> window is?
Re: New window on different screen [message #1698877 is a reply to message #1698872] Thu, 18 June 2015 13:39 Go to previous messageGo to next message
Bartlomiej Cichocki is currently offline Bartlomiej CichockiFriend
Messages: 23
Registered: April 2015
Junior Member
I uderstand, but parent is still null:
app.getChildren().get( 0 ).getWindows().add( window );
System.out.println( window.getParent() ); -- null; why?
Re: New window on different screen [message #1698950 is a reply to message #1698877] Fri, 19 June 2015 07:15 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Because getParent() is bound to the MElementContainer hierarchy! The
only way to access the parent window would be through EMF-API
(eContainer) which is internal.

I think you should file against the Eclipse Platform to provide API to
access the parent window.

Tom

On 18.06.15 15:39, Bartlomiej Cichocki wrote:
> I uderstand, but parent is still null:
> app.getChildren().get( 0 ).getWindows().add( window );
> System.out.println( window.getParent() ); -- null; why?
Previous Topic:MUIElement from wrong Context passed to control
Next Topic:Eclipse 3.* plugin issues when trying to create a stage.
Goto Forum:
  


Current Time: Wed Apr 24 13:36:29 GMT 2024

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

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

Back to the top