Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


UI: preview panel

Explorer ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

how do I create a preview of the results in this panel?

is it possible directly with Window Panel? 

Urraco37_0-1636382974649.png

 

    x = Number(a.text + " ");
    i = Number(b.text + " ");
    
    var panel = new Window("dialog", "test",undefined, { borderless: false });
    panel.alignChildren = "left";

    var grp1 = panel.add ("group");
    grp1.add ('statictext {text: "A", characters: 10, justify: "left"}');
    var a = grp1.add("edittext", undefined, "10");
    a.characters = 10;

    var grp2 = panel.add ("group");
    grp2.add ('statictext {text: "B", characters: 10, justify: "left"}');
    var b = grp2.add("edittext", undefined, "5");
    b.characters = 10;
    
    var grp3 = panel.add ("group");
    grp3.add ('statictext {text: "preview", characters: 10, justify: "left"}');
    var preview = grp3.add('statictext', undefined, x + i);
    preview.characters = 10;
    
    panel.show();
    

 

 

TOPICS
How to, Scripting

Views

84

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
community guidelines

correct answers 1 Correct answer

Advocate , Nov 08, 2021 Nov 08, 2021
var panel = new Window("dialog", "test", undefined, { borderless: false }); panel.alignChildren = "left"; var grp1 = panel.add("group"); grp1.add('statictext {text: "A", characters: 10, justify: "left"}'); var a = grp1.add("edittext", undefined, "10"); a.characters = 10; var grp2 = panel.add("group"); grp2.add('statictext {text: "B", characters: 10, justify: "left"}'); var b = grp2.add("edittext", undefined, "5"); b.characters = 10; var grp3 = panel.add("group"); grp3.add('statictext {text: "...

Likes

Translate

Translate
Adobe Community Professional ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

Try following,

var panel = new Window("dialog", "test", undefined, { borderless: false });
panel.alignChildren = "left";

var grp1 = panel.add("group");
grp1.add('statictext {text: "A", characters: 10, justify: "left"}');
var a = grp1.add("edittext", undefined, "10");
a.characters = 10;

var grp2 = panel.add("group");
grp2.add('statictext {text: "B", characters: 10, justify: "left"}');
var b = grp2.add("edittext", undefined, "5");
b.characters = 10;

var preview = Number(a.text) + Number(b.text);

var grp3 = panel.add("group");
grp3.add('statictext {text: "preview", characters: 10, justify: "left"}');
var preview = grp3.add('statictext', undefined, preview);
preview.characters = 10;

panel.show();
Best regards

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
community guidelines
Adobe Community Professional ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

Hi,

To add more, if you want to use palette instead of the dialog, replace

following line

var panel = new Window("dialog", "test", undefined, { borderless: false });

with

var panel = new Window("palette", "test", undefined, { borderless: false });

 

 

Best regards

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
community guidelines
Explorer ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

LATEST

Thanks for help but  there is no update for var preview...

in the meantime I had found a solution

that's about what I wanted

it s ok ?

 

var panel = new Window ("dialog","test", undefined);
var x = panel.add ("edittext", undefined, "5")
x.characters = 10;
var y = panel.add ("edittext", undefined, "4");
y.characters = 10;
var result = panel.add ("statictext", undefined, "9 mm");
result.characters = 10;

x.onChange = y.onChange = preview;
panel.show ();

function preview() {
result.text = Number(x.text) + Number(y.text) + " mm";
}

 

 

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
community guidelines
Advocate ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

var panel = new Window("dialog", "test", undefined, { borderless: false });
panel.alignChildren = "left";

var grp1 = panel.add("group");
grp1.add('statictext {text: "A", characters: 10, justify: "left"}');
var a = grp1.add("edittext", undefined, "10");
a.characters = 10;

var grp2 = panel.add("group");
grp2.add('statictext {text: "B", characters: 10, justify: "left"}');
var b = grp2.add("edittext", undefined, "5");
b.characters = 10;

var grp3 = panel.add("group");
grp3.add('statictext {text: "preview", characters: 10, justify: "left"}');
var c = grp3.add("edittext", undefined, Number(a.text) + Number(b.text));
c.characters = 10;

function change(x1, x2, x3) {
    x3.text = Number(x1.text) + Number(x2.text);
}
a.addEventListener("changing", function () {change(a, b, c)});
b.addEventListener("changing", function () {change(a, b, c)});

panel.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
community guidelines