

#Creating a button in indesign cc 2017 pro#

This line will stop you generate the OK/Cancel buttons, so the dialog won't render them. As I explained above, this line is just like you are asking the window to re-render the dialog, whenever you click 'Add Another' button. MyListOfColors.prevSel=ĬriteriaValues.push() event handler.callback functions put input into arrays Var addAnother_button = myEnterCriteriaGroup.add("button", undefined, "Add Another") ĪddAnother_button.onClick = add_AnotherInputLine //no passing parameters here! won't show button to be clicked! add button to add another row of fields to gather another set of user input Var myListOfColors = myEnterCriteriaGroup.add("dropdownlist",undefined,mySwatchNames) //dropdown field for choosing swatch Var myEnterCriteria = myEnterCriteriaGroup.add("edittext",undefined,"") //field for entering text criteria text entry field to enter criteria term MyEnterCriteriaGroup.add("statictext",undefined,"Criteria to Color Code") Var myEnterCriteriaGroup = maingroup.add("group") function adds criteria input collection fields (text criteria and swatch choice) You need this line to re-render the dialog, to have OK/Cancel showed up. After this function, if you create OK/Cancel buttons, they won't show up, because the line m圜(true) stop u generating those buttons. in the first time, there is another m圜(true) at the end of the function dd_inputFields(maingroup). Why I put this line here? Because when the script renders the add_inputFields(maingroup) Will be always at the very end of the dialog. and the maingroup is the same level as YES/NO group, so YES/NO So whenever you generate new fields, it will be always inside its Whenever you click on 'Add Another' button, the new fields will always You need to put those InputFields into a container, to make sure

Var maingroup = m圜Sdialog.add('panel')//Added line Var m圜Sdialog = new Window("dialog", "Setup Color Coding") I deleted some unnecessary lines as you can see. MyDialogButtons.add("button", undefined, "Cancel") Įdit: I added comments below the lines that I added, to make it more understanable. MyDialogButtons.add("button", undefined, "OK") Var myDialogButtons = m圜Sdialog.add("group") I have yet to figure out a solution from it, for my particular need.) var m圜Sdialog = new Window("dialog", "Setup Color Coding") Singelmann script and have studied it extensively. if you need them, they're simple arrays with text items or ask and I can provide the variables/arrays containing content. I've left out numerous priors (arrays, variables) used in the following code. And this is seen in the Data Browser because at this point in the script the cancelElement and defaultElement now equal = Object is invalid When I do that, those buttons no longer work after user utilizes the add_AnotherInputLine function.

(I could not figure out another way to get the OK-Cancel buttons to move or always stay at the bottom of the window!)īUT that removing-adding of the OK-Cancel button group is where my problem is surfacing. If the user fills in/chooses in the first 2 input fields and then ignores the Add Another button and uses the OK-Cancel buttons the script proceeds fine.īUT if the user clicks the Add Another button, the script utilizes a call-back/event handler function (add_AnotherInputline) to first remove the OK-Cancel button group and then add (through add_inputFields function) another group of the text edit field & dropdown, and then re-adds the OK-Cancel buttons. (group 1 = 1 text edit field and one dropdown list and the Add Another button ie I can show a simple, two group, ui window I'm trying to show a script ui window that will add another group of input fields IF the user clicks an Add Another button instead of the OK or Cancel buttons.
