Skip to main content
ajabon grinsmith
Community Expert
Community Expert
October 27, 2020
質問

How to keep EditText active after an event on CC

  • October 27, 2020
  • 返信数 1.
  • 613 ビュー

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.

このトピックへの返信は締め切られました。

返信数 1

Sunil Yadav
Legend
October 27, 2020

For making edittext active you just need this:

edittextBox.active = true;

 

Can you share your code where you are stuck?

ajabon grinsmith
Community Expert
Community Expert
October 27, 2020

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?

ajabon grinsmith
Community Expert
Community Expert
October 28, 2020

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.