Skip to main content
ajabon grinsmith
Community Expert
Community Expert
Oct 27, 2020 9:33 AM UTC
Question

How to keep EditText active after an event on CC

Hi, 

I have a ScriptUI I made earlier. There is an important structure in which EditText is triggered by the onEnterKey event, but since CC, this EditText has been deactivated after the event. I want to keep this EditText active.
This problem could not be solved by using onChange, onDeactivate.
Is there any effective way?
On Mac.

... I know that in the not too distant future, this will have to be redeveloped with CEP (or UXP?).

 

regards, regards.. I am very frustrated and in trouble.

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Sunil Yadav
Legend
Oct 27, 2020 10:59 AM UTC

For making edittext active you just need this:

edittextBox.active = true;

 

Can you share your code where you are stuck?

Translate
ajabon grinsmith
Community Expert
Community Expert
Oct 27, 2020 11:21 AM UTC

hi Sunil, this is simple code to test.

try to run it on InDesign. I use CC2019.

#target indesign
#targetengine "test"

var a = new Window("""palette{text:"test", 
E:EditText{characters:10, text:"test me"}}""");

a.E.onEnterKey = function(){
    $.writeln(this.text);
    }

a.show();

 

I wish E keep active, but it never.

This problem does not occur on ESTK.

I found that I could keep it active with shift + enter, but I also found that the event was executed 5 times ...

Have some idea?

Translate
ajabon grinsmith
Community Expert
Community Expert
Oct 28, 2020 4:48 AM UTC

Even if I was active in the event like this, I am seriously worried that it will be deactive when I leave the event.

var a = new Window("""palette{text:"test", 
E:EditText{characters:10, text:"test me"}}""");

a.E.onEnterKey = function(){
    $.writeln(this.text);
    this.active = true;    // added line
    }

a.show();

 

thanks.

Translate