Skip to main content
rechmbrs
Inspiring
March 6, 2020
Question

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

  • March 6, 2020
  • 1 reply
  • 2364 views

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

This topic has been closed for replies.

1 reply

Legend
March 7, 2020

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;
 
rechmbrs
rechmbrsAuthor
Inspiring
March 7, 2020

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:

 

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

 

RONC

Kukurykus
Legend
March 7, 2020
$.screens