How to manipulate dialogs?

95% of my UXP plugins are made up of modeless dialog boxes, I confess I’ve never had a problem with that. @justin2taylor two curiosities I have:
First: How to programmatically resize them without having to close and open again. Second: using the example of ScriptUI jsx, it would be possible to remove the “x” button from the top right corner. Do you know something about this?, please share.


I have a window that opens after some events are completed, however, I need to make some commands through the window and then close it with Ok to process the other events or cancel, so when I cancel, I can remove all the added tasks and return to the point starting point by clicking the cancel button, but if the user closes the window by clicking the “x” in the upper right corner, it will not be possible to remove all added tasks and return to the starting point

But you can:

        const response = await dialogElement.uxpShowModal(dialogOpts)
        dialogElement.remove()

        // do whatever with the `response` here

IIRC it’s different response depending on how dialog was closed. And you can even have your own response when user clicks some button to close the dialog:

dialog.close('Whatever you want goes here as a response')
1 Like

Thank @Karmalakas you for the tips. I already use your second method and I confess that I still don’t quite understand the first. I will study this method.