Highlighted

Changing enable=true to false in Script Up dialog

Advocate ,
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!

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

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();
TOPICS
Scripting

Views

95

Likes

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

Changing enable=true to false in Script Up dialog

Advocate ,
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!

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

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();
TOPICS
Scripting

Views

96

Likes

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
Sep 21, 2020 0
Adobe Community Professional ,
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

 

Likes

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
Reply
Loading...
Sep 21, 2020 0
Adobe Community Professional ,
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();

Likes

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
Reply
Loading...
Sep 21, 2020 0
Advocate ,
Sep 21, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Sep 21, 2020 0