Set Position (X and Y) of an Editor in Dialog-Mode

Hi,

I am trying to find a way to read the X and Y - Position and width and height of an existing
Entity-Editor in Dialog-Mode (CUBA 7).

I want to keep this Coordinates to set them to the next Editor-Screen, the user is opening.

The user should see the next opened dialog in the same position, he has moved the last to.

Is there a way ?

Thank you

Hi,

If your screen is opened as Dialog, you can use DialogWindow API:

@UiController("demo_NewScreen")
@UiDescriptor("new-screen.xml")
public class NewScreen extends Screen {
    @Subscribe("demoBtn")
    protected void onDemoBtnClick(Button.ClickEvent event) {
        // use instanceof to check mode if needed
        DialogWindow window = (DialogWindow) getWindow();

        int positionX = window.getPositionX();
        int positionY = window.getPositionY();

        // set new position to window
        window.setPosition(positionX + 10, positionY + 10);
    }
}

Please note that screen must be shown in a web browser before you read actual position X and Y values. However you can set them during opening of a screen.

Hi Yuriy,
I will try this.
Thanks very much.