When you need to validate user input in an edittext field, it’s not enough to do so in its onChange event — you must also validate it in the dialog’s onClose. It’s the only way to stop the dialog from closing after a click on the OK button, so that the user has a chance to correct his input. But what if that close event occurred because of an explicit user action to simply dismiss the dialog, like clicking the Cancel button?
Please just let me Cancel
By default, it seems that the close event does not distinguish between an “OK” close and a “Cancel” close. This can be problematic in input validations, because if your validator is designed to prevent the dialog from closing upon detection of faulty input, it should absolutely not do so in the event of an explicit “Cancel” (or Esc) close. Continue reading
Here is a set of three utility functions I use when debugging my InDesign scripts, to ensure that they work correctly in environments with different measurement units (points, millimeters, etc.) and ruler origins.
From pixels to points to ciceros, InDesign allows users to pick from 15 different measurement units to use in various places of their documents. Thanks to this versatility, it can sometimes be hard to predict how a script will act in a measurement unit environment even slightly different from yours.
Where are these measurement units?
There are three major places where measurement units could vary depending on the user environment: Continue reading