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

Is it possible to change focus in dialog after input?

Explorer ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

Is it possible to change focus in dialog window after input?
For instance, after the input changed (there could be any value) the focus should be on the button, so that we could press Enter on the keyboard to submit the dialog.
fghjfgj.jpg

TOPICS
Scripting

Views

1.2K

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

correct answers 1 Correct answer

Community Expert , May 06, 2018 May 06, 2018

Same procedure as in your other thread

var w = new Window("dialog", "Example Dialog");

w.dialogGroup = w.add("group");

w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");

w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");

w.dialogGroup.el1.active = true;

w.quitBtn = w.add("button", undefined, "Ok");

w.defaultElement = w.quitBtn;

w.dialogGroup.el1.onChange = function() {

    w.quitBtn.active = true;

    }

w.show();

Have fun

Votes

Translate

Translate
Adobe
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

Same procedure as in your other thread

var w = new Window("dialog", "Example Dialog");

w.dialogGroup = w.add("group");

w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");

w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");

w.dialogGroup.el1.active = true;

w.quitBtn = w.add("button", undefined, "Ok");

w.defaultElement = w.quitBtn;

w.dialogGroup.el1.onChange = function() {

    w.quitBtn.active = true;

    }

w.show();

Have fun

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 ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

But how can I output the value of el1 element?

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
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

var aTxt = null;

var w = new Window("dialog", "Example Dialog");

w.dialogGroup = w.add("group");

w.dialogGroup.el1 = w.dialogGroup.add("edittext", undefined, "Edit Text 1");

w.dialogGroup.el2 = w.dialogGroup.add("edittext", undefined, "Edit Text 2");

w.dialogGroup.el1.active = true;

w.quitBtn = w.add("button", undefined, "Ok");

w.defaultElement = w.quitBtn;

w.dialogGroup.el1.onChange = function() {

    aTxt = w.dialogGroup.el1.text;

    w.quitBtn.active = true;

    }

w.show();

alert(aTxt);

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 ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

The only tning  which is working strange now is how the dialog responds when submit the form by mouse (of course, this was not required in the original question). Now we need to click the button twice by mouse to submit it.

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
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

In your code or in my snippet?

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 ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

In your snippet.

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
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

That's really hard. For me the snippet works as expected (but did only tried from ESTK).

Sometimes Illu scripts make strange things. Maybe try this cumbersome workaround PromptToSaveChanges / ScriptUI Default Highlighted Button

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 ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

I commented the line
w.quitBtn.active = true;

and set onClick() function for the button and after that seems it's working as expected 🙂

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
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

LATEST

Yes. That is the normal behavior. But I thought you want to highlighting the OK button after changing editText1.

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