• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

In Scriptui, does using the ESC key work to close a palette as it does a dialog?

Engaged ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

In Scriptui, does using the ESC key work to close a palette as it does a dialog?  I've always used the ESC key for closing dialogs and had to put a button with onClick= win.close(); in a palette to close the window.

 

I have colored buttons working in a palette also.

 

RONC

TOPICS
Actions and scripting , SDK

Views

2.0K

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
Adobe
People's Champ ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

Try to use

 

palette.addEventListener("keydown", key_handle, false);

 

function key_handle(e)
{
if (e.keyIdentifier == "U+001B") palette.close;

// or

if (e.keyName == "Escape") palette.close;
}

 

// not tested

 

For this to work, there must always be an active control.
Force set
some_control.active = true;
 

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
Engaged ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

r-bin,

Thanks for the response.

 

Doesn't "some_control.active = true;" mean that the palette has to have been touched by the cursor for the ESC to work?  If so, it is same amount of work for user as a close button.  Without it, we loose backward compatiblity but make user do two things to close the palette.  I'm going to try it but was just wondering about it's use.

 

Another question:  the CALC has grown to over a 100 buttons which means I need to make it fit within the screen dimensions or that some options have to be turned off.  How do I get the screen width and height so I can check on whether the palette will fit?

 

You might like to see the CALC part and it's colored buttons.  Here is a screen capture with one user's color scheme:

Palette with colored buttons and textPalette with colored buttons and text

 

Thanks to you and K,  this tool is very helpful.  I plan to put the CALC part on GIThub it a while.

 

RONC

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
LEGEND ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

$.screens

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
Engaged ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

K,

 

Thanks.  Just what I needed.

RONC

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
Advocate ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

You can see the calculator panel code
I still don't understand what it is

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
Engaged ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

geppettol66959005,

CALC is a simple scientific calculator that is part of a larger calculator which attaches to a number of databases to supply the user with info in processing an image.  I'm not at liberty to discuss that part any further.

 

As I said I will release the source code to GIThub hopefully soon for the CALC palette.  r-bin and K have been extremely helpful getting to this stage.

 

RONC

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
Explorer ,
Apr 16, 2022 Apr 16, 2022

Copy link to clipboard

Copied

LATEST

I am also curious why you have to have an active control to make this work. For example in the below example script:

---------------------------------------------------------------------------------------------------------------------------------------------

#targetengine "session"; // not needed in Illustrator/AfterEffects

myPalette = new Window ("palette", "Example_2", undefined);
myPalette.addEventListener("keydown", function (kd) {key_pressed(kd)})
Cancel_button = myPalette.add("button", undefined, "Cancel")
myPalette.show()
 ---------------------------------------------------------------------------------------------------------------------------------------------
 
You cannot close the palette without clicking the x in the top right. However, in the below example script:
--------------------------------------------------------------------------------------------------------------------------------------------- 
#targetengine "session"; // not needed in Illustrator/AfterEffects

myPalette = new Window ("palette", "Example_2", undefined);
myPalette.addEventListener("keydown", function (kd) {key_pressed(kd)})
var edit = myPalette.add ("edittext")
edit.active = true;
Cancel_button = myPalette.add("button", undefined, "Cancel")
myPalette.show()
---------------------------------------------------------------------------------------------------------------------------------------------
 
You are able to hit the ESC key to close the pannel, but only if the editbox is active. So for example, if you were in the palette, clicked off of the exit box, then hit the ESC key, the palette would not close. If you clicked on the editibox and hit the ESC key, the palette would close. 
 
I want to know if it is possible to use the ESC key to close a palette without going through an editbox. I want to just have the palette open and be able to hit the ESC key to close it. Seems simple enough. Does anyone know how to do this?

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