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

Arrange elements in the dialog window.

Engaged ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

Hello everyone, everything good?
Guys how do I resize the window pane 2 removing empty spaces when I select elements in window1? Thanks.

Captura de tela 2022-07-23 115548.jpg

w = new Window("dialog");  w.text = "My Dialog"; 
w.orientation = "column"; w.alignChildren = ["center","top"]; 
cb1 = w.add("checkbox", undefined, undefined, {name: "cb1"}); cb1.text = "Content 1"; 
cb2 = w.add("checkbox", undefined, undefined, {name: "cb2"}); cb2.text = "Content 2"; 
cb3 = w.add("checkbox", undefined, undefined, {name: "cb3"}); cb3.text = "Content 3"; 
bt1 = w.add("button", undefined, undefined, {name: "bt1"}); bt1.text = "Only selected"; 

bt1.onClick = function(){ dlg2();}

w.show();


function dlg2(){
    w2 = new Window("dialog"); 
    w2.text = "FinalisarPedido"; 
    w2.orientation = "column"; 
    w2.alignChildren = ["center","top"]; 
    p1 = w2.add("panel", undefined, undefined, {name: "p1"});     p1.text = "Only selected"; 
    p1.orientation = "column";     p1.alignChildren = ["left","top"]; 
    st1 = p1.add("statictext", undefined, undefined, {name: "st1"});  st1.text = "Content 1"; 
    st2 = p1.add("statictext", undefined, undefined, {name: "st2"}); st2.text = "Content 2"; 
    st3 = p1.add("statictext", undefined, undefined, {name: "st3"}); st3.text = "Content 13"; 
    bt2 = w2.add("button", undefined, undefined, {name: "bt2"});  bt2.text = "Close"; 
    
    if(cb1.value){st1.visible=true}else{st1.visible=false};  
    if(cb2.value){st2.visible=true}else{st2.visible=false};
    if(cb3.value){st3.visible=true}else{st3.visible=false};


    bt2.onClick = function(){ w2.close()}
    w2.show();
}
TOPICS
Actions and scripting

Views

204

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

Guide , Jul 23, 2022 Jul 23, 2022

 

w = new Window("dialog");  w.text = "My Dialog"; 
w.orientation = "column"; w.alignChildren = ["center","top"]; 
cb1 = w.add("checkbox", undefined, undefined, {name: "cb1"}); cb1.text = "Content 1"; 
cb2 = w.add("checkbox", undefined, undefined, {name: "cb2"}); cb2.text = "Content 2"; 
cb3 = w.add("checkbox", undefined, undefined, {name: "cb3"}); cb3.text = "Content 3"; 
bt1 = w.add("button", undefined, undefined, {name: "bt1"}); bt1.text = "Only selected"; 

bt1.onClick = function(){ dlg2();}
...

Votes

Translate

Translate
Adobe
Guide ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

 

w = new Window("dialog");  w.text = "My Dialog"; 
w.orientation = "column"; w.alignChildren = ["center","top"]; 
cb1 = w.add("checkbox", undefined, undefined, {name: "cb1"}); cb1.text = "Content 1"; 
cb2 = w.add("checkbox", undefined, undefined, {name: "cb2"}); cb2.text = "Content 2"; 
cb3 = w.add("checkbox", undefined, undefined, {name: "cb3"}); cb3.text = "Content 3"; 
bt1 = w.add("button", undefined, undefined, {name: "bt1"}); bt1.text = "Only selected"; 

bt1.onClick = function(){ dlg2();}

w.show();


function dlg2(){
    w2 = new Window("dialog"); 
    w2.text = "FinalisarPedido"; 
    w2.orientation = "column"; 
    w2.alignChildren = ["center","top"]; 
    p1 = w2.add("panel", undefined, undefined, {name: "p1"});     p1.text = "Only selected"; 
    p1.orientation = "column";     p1.alignChildren = ["left","top"]; 
    if(cb1.value) {st1 = p1.add("statictext", undefined, undefined, {name: "st1"});  st1.text = "Content 1"; }
    if(cb2.value) {st2 = p1.add("statictext", undefined, undefined, {name: "st2"}); st2.text = "Content 2"; }
    if(cb3.value) {st3 = p1.add("statictext", undefined, undefined, {name: "st3"}); st3.text = "Content 13"; }
    bt2 = w2.add("button", undefined, undefined, {name: "bt2"});  bt2.text = "Close"; 

    bt2.onClick = function(){ w2.close()}
    w2.show();
}

 

or, for example:

 

w = new Window("dialog"); w.text = "My Dialog";
w.orientation = "column"; w.alignChildren = ["center", "top"];
p = w.add("panel", undefined, 'Select items'); p.margins = [10, 15, 10, 10];
g = p.add('group'); g.orientation = "column"; g.alignChildren = ["center", "top"];
cb1 = g.add("checkbox", undefined, "Content 1");
cb2 = g.add("checkbox", undefined, "Content 2");
cb3 = g.add("checkbox", undefined, "Content 3");
bt1 = w.add("button", undefined, "Only selected", { name: "bt1" });

bt1.onClick = function () {
    if (this.text != 'Close') {
        for (var i = 0; i < g.children.length; i++) if (g.children[i].value) p.add("statictext", undefined, g.children[i].text)
        p.remove(g)
        if (!p.children.length) p.add("statictext", undefined, 'No items')
        w.text = 'FinalisarPedido'
        p.text = 'Only selected'
        this.text = 'Close'
        w.layout.layout(true)
    }
    else w.close()
}
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
Engaged ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

LATEST

@jazz-y ,man you are a genius! Both alternatives worked very well. Thanks again!

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