<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ToolValidator enabled property defaults in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/toolvalidator-enabled-property-defaults/m-p/1364893#M76801</link>
    <description>&lt;P&gt;Okay, I feel like I'm going crazy, here.&lt;/P&gt;&lt;P&gt;I'm trying to build a Script Tool where a Boolean checkbox input controls another parameter that accepts a Feature Class, which I remember being fairly simple in ArcMap 10.7.&lt;/P&gt;&lt;P&gt;I can get the tool to successfully turn the Feature Class inputs on and off after the tool is running, but I can't get them to&amp;nbsp;&lt;EM&gt;start&lt;/EM&gt; disabled.&lt;/P&gt;&lt;P&gt;Parameters 0 &amp;amp; 1 are the two Booleans in question.&lt;BR /&gt;Parameters 3 &amp;amp; 4 are the respective Feature Classes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        
        self.params[3].enabled = False
        self.params[4].enabled = False

        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought the above would be all I need to get these two parameters to&amp;nbsp;&lt;U&gt;&lt;EM&gt;start&lt;/EM&gt;&lt;/U&gt; as disabled, but the tool doesn't seem to acknowledge the command.&lt;/P&gt;&lt;P&gt;I can confirm &lt;FONT color="#FF0000"&gt;initializeParameters&amp;nbsp;&lt;/FONT&gt;&lt;EM&gt;is running&lt;/EM&gt; when the tool opens, because I threw a test dummy in there* and it worked.&amp;nbsp; (*I wrote placeholder text into the value of one of the parameters, and it successfully shows up when you open the tool)&lt;/P&gt;&lt;P&gt;The only place I can seem to get the tool to recognize the &lt;U&gt;.enabled&lt;/U&gt;&amp;nbsp;property right out of the gate is if I put it in&amp;nbsp;&lt;FONT color="#33CCCC"&gt;&lt;FONT color="#FF0000"&gt;__init__&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.&amp;nbsp; But then it fails to update properly from &lt;FONT color="#FF0000"&gt;updateParameters&lt;/FONT&gt;, because &lt;FONT color="#FF0000"&gt;__init__ &lt;/FONT&gt;seems to be overriding whatever I put in &lt;FONT color="#FF0000"&gt;updateParameters&lt;/FONT&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#33CCCC"&gt;&lt;FONT color="#000000"&gt;I managed to figure out the below workaround, but I'm trying to figure out why I couldn't just put "&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;self.params[3].enabled = False&lt;/FONT&gt;&lt;/STRONG&gt;" into &lt;FONT color="#FF0000"&gt;initializeParameters &lt;/FONT&gt;to set the default state and be done with it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()
        
        # Since 0 and 1 default to False, this works for initial state.  It also avoids overriding later, because the checkbox IS the desired state.
        self.params[3].enabled = self.params[0].value
        self.params[4].enabled = self.params[1].value

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        
        if self.params[0].altered:
            self.params[3].enabled = self.params[0].value
        
        if self.params[1].altered:
            self.params[4].enabled = self.params[1].value
        
        return

    def updateMessages(self):
        # Customize messages for the parameters.
        # This gets called after standard validation.
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Dec 2023 23:33:43 GMT</pubDate>
    <dc:creator>MErikReedAugusta</dc:creator>
    <dc:date>2023-12-28T23:33:43Z</dc:date>
    <item>
      <title>ToolValidator enabled property defaults</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/toolvalidator-enabled-property-defaults/m-p/1364893#M76801</link>
      <description>&lt;P&gt;Okay, I feel like I'm going crazy, here.&lt;/P&gt;&lt;P&gt;I'm trying to build a Script Tool where a Boolean checkbox input controls another parameter that accepts a Feature Class, which I remember being fairly simple in ArcMap 10.7.&lt;/P&gt;&lt;P&gt;I can get the tool to successfully turn the Feature Class inputs on and off after the tool is running, but I can't get them to&amp;nbsp;&lt;EM&gt;start&lt;/EM&gt; disabled.&lt;/P&gt;&lt;P&gt;Parameters 0 &amp;amp; 1 are the two Booleans in question.&lt;BR /&gt;Parameters 3 &amp;amp; 4 are the respective Feature Classes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        
        self.params[3].enabled = False
        self.params[4].enabled = False

        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought the above would be all I need to get these two parameters to&amp;nbsp;&lt;U&gt;&lt;EM&gt;start&lt;/EM&gt;&lt;/U&gt; as disabled, but the tool doesn't seem to acknowledge the command.&lt;/P&gt;&lt;P&gt;I can confirm &lt;FONT color="#FF0000"&gt;initializeParameters&amp;nbsp;&lt;/FONT&gt;&lt;EM&gt;is running&lt;/EM&gt; when the tool opens, because I threw a test dummy in there* and it worked.&amp;nbsp; (*I wrote placeholder text into the value of one of the parameters, and it successfully shows up when you open the tool)&lt;/P&gt;&lt;P&gt;The only place I can seem to get the tool to recognize the &lt;U&gt;.enabled&lt;/U&gt;&amp;nbsp;property right out of the gate is if I put it in&amp;nbsp;&lt;FONT color="#33CCCC"&gt;&lt;FONT color="#FF0000"&gt;__init__&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.&amp;nbsp; But then it fails to update properly from &lt;FONT color="#FF0000"&gt;updateParameters&lt;/FONT&gt;, because &lt;FONT color="#FF0000"&gt;__init__ &lt;/FONT&gt;seems to be overriding whatever I put in &lt;FONT color="#FF0000"&gt;updateParameters&lt;/FONT&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#33CCCC"&gt;&lt;FONT color="#000000"&gt;I managed to figure out the below workaround, but I'm trying to figure out why I couldn't just put "&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;self.params[3].enabled = False&lt;/FONT&gt;&lt;/STRONG&gt;" into &lt;FONT color="#FF0000"&gt;initializeParameters &lt;/FONT&gt;to set the default state and be done with it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()
        
        # Since 0 and 1 default to False, this works for initial state.  It also avoids overriding later, because the checkbox IS the desired state.
        self.params[3].enabled = self.params[0].value
        self.params[4].enabled = self.params[1].value

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        
        if self.params[0].altered:
            self.params[3].enabled = self.params[0].value
        
        if self.params[1].altered:
            self.params[4].enabled = self.params[1].value
        
        return

    def updateMessages(self):
        # Customize messages for the parameters.
        # This gets called after standard validation.
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 23:33:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/toolvalidator-enabled-property-defaults/m-p/1364893#M76801</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2023-12-28T23:33:43Z</dc:date>
    </item>
  </channel>
</rss>

