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

Script UI

Guest
Jul 13, 2014 Jul 13, 2014

Copy link to clipboard

Copied

If have a button, when click "Button 1",it will pop up second dialog and then click "Button 2", need to pop up third dialog

but can't pop the third dialog, why?

w = new Window ("dialog", "Test", undefined, {resizeable: true});

var myText = w.add("edittext", undefined, "", {multiline: true})

myText.alignment = ["fill", "fill"];

myText.minimumSize = [300, 30];

w.location = [55, 140];

myPrinter = w.add("button", undefined, "Button 1");

var w2 = new Window ("dialog");

w2 .add ("button", undefined, "Button 2");

var w3 = new Window ("dialog");

w3 .add ("button", undefined, "Button 3");

myPrinter.onClick = function() {

           w2.show();

           }

w3.onClick = function() {

         w3.show();

}

w.show();

TOPICS
Scripting

Views

499
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

Contributor , Jul 13, 2014 Jul 13, 2014

var w2 = new Window ("dialog");

w2 .add ("button", undefined, "Button 2"); /// <= HERE

var w3 = new Window ("dialog");

w3 .add ("button", undefined, "Button 3");

myPrinter.onClick = function() {

          w2.show();

          }

w3.onClick = function() { /// <= AND HERE

        w3.show();

}

w.show();

Hi, your code is not pointed Button2 ,

var button2 = w2 .add ("button", undefined, "Button 2");

set variable and

button2.onClick = function() {...}


OR


w2 .add ("button", undefined, "Button 2"
...

Votes

Translate
People's Champ ,
Jul 13, 2014 Jul 13, 2014

Copy link to clipboard

Copied

Works fine here:

var i = 0;

newWindow();

function newWindow(){

i++;

var w = new Window ("dialog", "Window " + i);

var b = w.add("button", undefined, "New Window");

b.onClick = newWindow;

w.onShow = function(){

w.location.x = w.location.y = 100 + i *30;

}

w.show();

}

Votes

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
Guest
Jul 13, 2014 Jul 13, 2014

Copy link to clipboard

Copied

Thx but that not what I want

each button I click have different action to do

yr script seem click the button the action is the same

Votes

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
Contributor ,
Jul 13, 2014 Jul 13, 2014

Copy link to clipboard

Copied

var w2 = new Window ("dialog");

w2 .add ("button", undefined, "Button 2"); /// <= HERE

var w3 = new Window ("dialog");

w3 .add ("button", undefined, "Button 3");

myPrinter.onClick = function() {

          w2.show();

          }

w3.onClick = function() { /// <= AND HERE

        w3.show();

}

w.show();

Hi, your code is not pointed Button2 ,

var button2 = w2 .add ("button", undefined, "Button 2");

set variable and

button2.onClick = function() {...}


OR


w2 .add ("button", undefined, "Button 2", {name: "Button 2"});


set name and call 'Button 2' element


w2['Button 2'].onClick = function() {...}


thank you

Votes

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
Guest
Jul 14, 2014 Jul 14, 2014

Copy link to clipboard

Copied

LATEST

I fix my button to set variable but when I click button2 can response the action print, is it something wrong?

       var w1 = new Window ('dialog', 'Test', undefined, {resizeable: true});

       var myText = w1.add('edittext', undefined, 'TEST', {multiline: true});

            myText.alignment = ['fill', 'fill']

            myText.minimumSize = [300, 30]

            w1.location = [55, 140]

       var myButton1 = w1.add('button', undefined, 'Button 1')

        var w2 = new Window ('dialog');

        var panel1 = w2.add ('panel');

        var panel2 = w2.add ('Group');

        var myButton2 = panel2.add('button', undefined, 'myButton2');

                                 panel2.alignChildren ='right';

myButton1.onClick = function() {

    w2.show();

    }

myButton2.onClick = function() {

    app.activeDocument.print();

   }

w1.show();

Votes

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