• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

AFX - How to Cancel UI Close Event

New Here ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

When the user clicks the OS-specific close icon in the title
bar of my interface he has the choice of not closing it so he can do something else he forgot to do.

My script works fine in Extend Script, but in After Effects 2019( v.17.0.0) it disables the close button after the onClose event returns false for the first time. Must I create a specific close button to do this?

 

This is the code:

var dlg = new Window('window', 'Close Test', undefined);

var pn = dlg.add('panel');
pn.add('statictext', [0,0,60,20], 'LINE 1');

pn.add('statictext', [0,0,60,20], 'LINE 2');

 

dlg.onClose = function()
{
if (Window.confirm('Do you really wanna close?', true, 'CLOSE UI'))
{
return true;
}
else
{
return false;
}
}dlg.show()

TOPICS
Error or problem , How to , Scripting , User interface or workspaces

Views

374

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

I think after one of the releases, the .onClose() event actually never get fired anymore.  I'm not even sure you can close a ScriptUI panel via a button ā€” I know you can assign buttons to close modal dialogs spawned from a ScriptUI panel, but not sure if its possible to close the panel itself.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

LATEST

The onClose event is fired (as you would be able to see by runing my short code). The problem is that after it returns false for the first time the close button becomes inactive.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines