Open a screen inside an already opened screen (both in dialog mode) programmatically

Hi all
well, I have this main-screen that shows a pop-up like screen once an element is selected on a table
y that pop-up screen I have tabs which one of them has another table where to select an element and show the third pop-up like screen
this last screen is showed smaller than the second and I would like to
1- show the original screen size (the third screen original size)
OR
2- show the size of the second screen

I have tried with

thirdScreen.getWindow().setHeight(String.valueOf(this.getWindow().getHeight()));
thirdScreen.getWindow().setWidth(String.valueOf(this.getWindow().getWidth()));

the image shows the second and third screens

any ideas are welcommng

Hello!

To set width and height of dialog window you should use the following methods:

  • DialogWindow#setDialogWidth();
  • DialogWindow#setDialogHeight();

You can cast the window to DialogWindow when screen created with OpenMode.DIALOG.

@Subscribe("openDialogBtn")
public void onOpenDialogBtnClick(Button.ClickEvent event) {
    ThirdDialogScreen screen = screens.create(ThirdDialogScreen.class, OpenMode.DIALOG);

    if (getWindow() instanceof DialogWindow) {
        DialogWindow window = (DialogWindow) getWindow();

        String dialogWidth = new Float(window.getDialogWidth()).intValue()
                + window.getDialogWidthUnit().getSymbol();
        String dialogHeight = new Float(window.getDialogHeight()).intValue()
                + window.getDialogHeightUnit().getSymbol();

        ((DialogWindow) screen.getWindow()).setDialogWidth(dialogWidth);
        ((DialogWindow) screen.getWindow()).setDialogHeight(dialogHeight);
    }
    screen.show();
}

Also, you can define width and height using @DialogMode annotation (see 3.5.1.1.1. Screen Controller Annotations) and declaratively (see 3.5.1.2. Screen XML Descriptors).

great! it did work

more, notes
I’m using the screen.editor().withScreenClass()
I did set .withOpenMode(OpenMode.DIALOG)
but I forget to add the getSymbol() to set the height and width

thanks!!