Highlighted

AFX - How to Cancel UI Close Event

New Here ,
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

220

Likes

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

AFX - How to Cancel UI Close Event

New Here ,
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

221

Likes

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
Enthusiast ,
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.

Likes

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
Reply
Loading...
cbuenov LATEST
New Here ,
May 01, 2020

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...