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

Changing enable=true to false in Script Up dialog

Community Expert ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

A Script UI diagog question... 

How can I change the enabled=true/false status of text a and b text inside a windows script, when the dialog is still open.
I have try adding this at the end but nothing happens.
if (checkbox1.value == true);
a.enabled = false;​

var w = new Window("dialog"); 

    var checkbox1 = w.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
    checkbox1.text = "a check box"; 

var a = w.add('edittext {justify: "center", properties: {name: "a"}}'); 
    a.preferredSize.width = 100; 

var b = w.add('edittext {justify: "center", properties: {name: "b"}}'); 
    b.preferredSize.width = 100; 

var button1 = w.add("button", undefined, undefined, {name: "button1"}); 
    button1.text = "OK"; 

w.show();

Thanks!

TOPICS
Scripting

Views

471

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 , Sep 21, 2020 Sep 21, 2020

Add an onClick handler: 

var w = new Window("dialog"); 

var checkbox1 = w.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
    checkbox1.text = "a check box"; 

    checkbox1.onClick = function() {
        if (checkbox1.value == true) { a.enabled = false; }
        else { a.enabled = true; }
    }

var a = w.add('edittext {justify: "center", properties: {name: "a"}}'); 
    a.preferredSize.width = 100; 

var b = w.add('edittext {justify: "center", properties: {name: "b"}}'); 
    b.
...

Votes

Translate

Translate
Community Expert ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

Put that code inside the onClick event handler of checkbox. See the following

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#CheckboxSUI.html

-Manan

 

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 ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

Add an onClick handler: 

var w = new Window("dialog"); 

var checkbox1 = w.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
    checkbox1.text = "a check box"; 

    checkbox1.onClick = function() {
        if (checkbox1.value == true) { a.enabled = false; }
        else { a.enabled = true; }
    }

var a = w.add('edittext {justify: "center", properties: {name: "a"}}'); 
    a.preferredSize.width = 100; 

var b = w.add('edittext {justify: "center", properties: {name: "b"}}'); 
    b.preferredSize.width = 100; 

var button1 = w.add("button", undefined, undefined, {name: "button1"}); 
    button1.text = "OK"; 

w.show();

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 ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

LATEST

Thanks Brian! 
Thanks also Manan for the link. I was not even aware there was a CC2020 API Object Model available.

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