setCloseable Jmix version: 2.4.2

Hi,

I’m using getWindow().setCloseable(false) in Jmix version: 1.5.5 to prevent the user to close the window with the X symbol. (the X symbol is not displayed)

How can I do the same in Jmix version: 2.4.2?

Thanks

Hi,

Jmix 2.x shows a single view at a time. Hence, the closeable API is redundant.

Regards,
Gleb

So it’s not possible?

Preferably I don’t want to show the X (close window symbol) to the user. The user must close via the Close button I add. The close button has it’s own logic.

Or if it’s not possible to hide the X, can I:
Disable the close action behind it. If the user clicks on it, nothing happens
or
Put my own logic behind it. The same logic as my close button.

Thanks

Do you mean dialog windows? Regular views have no X button.

Yes, dialog windows.
afbeelding

You can use the following workaround:

@Subscribe
public void onReady(final ReadyEvent event) {
    Dialog dialog = UiComponentUtils.findDialog(this);
    if (dialog != null) {
        dialog.addClassName("close-button-hidden");
    }
}
.close-button-hidden .jmix-dialog-window-close-button {
    display: none;
}