Jump to content

Dialog with text input


eiranix

Recommended Posts

I have not made a dialog box before, but I pieced this together from examples online... Can someone help me with a few of things? (sorry if these are silly questions)

 

1 - How can I set the width of the input fields?

2 - How can I have the input fields in a row but then have the checkbox and button underneath?

3 - When the checkbox is checked, how can I make the last 3 fields become greyed out and take the value in the first field?

var box = new Window('dialog', "My Dialog");box.orientation='row';box.panel1 = box.add('panel', undefined, "Left");box.panel2 = box.add('panel', undefined, "Right");box.panel3 = box.add('panel', undefined, "Top");box.panel4 = box.add('panel', undefined, "Bottom");box.left_input = box.panel1.add('edittext', undefined, "0");box.right_input = box.panel2.add('edittext', undefined, "0");box.top_input = box.panel3.add('edittext', undefined, "0");box.bottom_input = box.panel4.add('edittext', undefined, "0"); box.checkbox = box.add('checkbox',undefined, "Equal Margins", {name:'equal'}); box.closeBtn = box.add('button',undefined, "Ok", {name:'close'}); box.closeBtn.onClick = function(){  var left = box.left_input.text  var right = box.right_input.text  var top = box.top_input.text  var bottom = box.bottom_input.text  box.close();  alert(left);} box.show()
Link to comment
Share on other sites

It's Javascript, as far as that is common, but the API is different than Javascript running in a browser. In a browser, for example, a Window object does not have an orientation property nor an add method, and you don't explicitly create a new Window object (you use window.open instead).You'll probably need to look up the documentation for Illustrator to see what their API has available to use. Maybe you can use something similar to CSS to set the widths and things, or maybe they have their own method for doing that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...