Skip to main content
October 19, 2012
Question

Adding button in my UI

  • October 19, 2012
  • 1 reply
  • 1166 views

Hi All,

I m creating a User Interface, with some textbox and now I m in need of inserting some buttons.

I have used the below coding for adding text box:

      with (dialogRows.add()) 

      {

        var NewStyle = textEditboxes.add({editContents:'Enter the Style Name', minWidth:180});

        }

And it is working fine. In the same manner I have tried for button:

        var NewBut = button.add({label:'search'});

But it is throwing an error.

Please help us to do the same.

Thanks,

Christy

This topic has been closed for replies.

1 reply

Legend
October 19, 2012

#targetengine "session"

var myDialog = new Window('palette', 'Sample Interface');

var myGroup = myDialog.add('group', undefined, '');

var newButton1 = myGroup.add('button', undefined, 'Sample Button1', {name:'Button'});

var newButton2 = myGroup.add('button', undefined, 'Sample Button2', {name:'Button'});

myDialog.show();

newButton1.onClick = function() {

alert("button1");

}

 

newButton2.onClick = function() {

alert("button1");

}

Hope this will help you...

- Vandy

October 20, 2012

Hi Vandy,

Thanks for your response. But the thing is what you have suggested is a differnet way of creating the interface.

But I have followed is as specified in the Indesign Scripting reference.pdf file.

Also, in that reference PDF file, could not able to find any syntex for buttons. So that I have asked in forum.

Thanks,

Christy

Jongware
Community Expert
Community Expert
October 20, 2012

The reason you cannot find it in the reference guide is because buttons are not supported by the old style dialog builder (http://jongware.mit.edu/indesigncs3jshelp/index_19.html). Thus Vandy88's suggestion to use ScriptUI instead.