I'm having issue with using validation to update an input box. Some background:
I created a tool to update and resize text in ArcGIS. This is done by having a series of text elements and shape elements with matching names. So there is a shape element named "Title" and a text element named "Title". I can then resize and move the shape element around in my layout and then run this tool to update the text, resize and center within the shape element.
The tool has a validation script that is supposed to generate a list of these element names in box A and then based on which one the user selects, place the actual text in box B. In this way the user can see exactly which text element they have selected and then edit that text in box B before running the tool. The problem is that after you edit the text in box B, the validation resets the text to the original value.
How can I prevent this?
This is what I tried:
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
mxd = arcpy.mapping.MapDocument("CURRENT")
if self.params[0].altered:
temp=arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT",self.params[0].value)
self.params[1].value = temp[0].text
return
So the behavior now is that the first box populates without issue but switching between values doesn't update box B with the text.