Programmatically hide panel

Hello

I’d like a way to close my panel on the click of a cancel button. Something along the lines of:

this.close().

Is there a way to do so?

please use search before posting to see relevant discussions.

TL;DR : No, not at this moment.

There is no mechanism in UXP to close a plugin’s panel. (You can show panels in PS prerelease, but not hide them programmatically).

Instead of hiding, render some UI to the user that explains what the issue is, and what they can do to rectify the issue. Otherwise the user may wonder why the plugin isn’t working as expected – which can lead to increased support requirements.

source and discussion here.

Dear Maher,

Thank you for your reply. I searched and found your suggested workaround. However, this won’t be suitable for my needs.

I’m wondering if I need to go down the route of a single panel with changing content. However, the issue with this is then that I have a panel fixed at one size which looks incorrect for some UI ‘screens’.

All my panels are shown on loading the plugin as well - any ideas if there is a default flag to not be opened?

does this help?

The loadEvent field allows a plugin to specify when it is loaded. The possible values are:

  • use: The plugin is loaded when needed (when its UI become visible, or when a plugin command is executed). This is the default value.
  • startup: The plugin is loaded automatically shortly after Photoshop is launched.
1 Like

Sadly loadEvent does not define if panels are opened or not. They are always opened on plugin load. But once plugin is loaded, next time panels will remain in the last used state

1 Like

I haven’t tried but I wonder if entrypoint setup can help creating panels conditionally.

but seems too much work tbh

1 Like

AFAIK, no. One of my plugins would get a huge benefit if I could just create or remove panels on the go :slight_smile:

1 Like