3

The validation tab in your script tool properties allows you to put parameters in categories. The help states:

Put parameters in different categories. Categories are expandable window shades with a collection of parameters.

enter image description here

I am using the categories to organize my parameters, so I don't care about the expandable/collapsible feature; it just adds a lot of time to the user. This is all within a normal toolbox, not a script toolbox. v10.1

Does anyone know how to have these categories expanded by default?

Here is my only validation code. I am only utilizing categories. The other parts are the default.

def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""
    self.params[0].category = "General"
    self.params[1].category = "General"
    self.params[2].category = "Inudaciones"
    self.params[3].category = "Cienegas"
    self.params[4].category = "DrenajesPrincipal"
    self.params[5].category = "DrenajesSensillos"
    self.params[6].category = "Inudaciones"
    self.params[7].category = "Cienegas"
    self.params[8].category = "DrenajesPrincipal"
    self.params[9].category = "DrenajesSensillos"
    return
1
  • Can you include a link to the Help that you mention, and also state the version of ArcGIS that you are using, please?
    – PolyGeo
    Jan 31, 2017 at 22:41

1 Answer 1

6

This isn't possible in python, but you can by using a custom stylesheet.

  1. Copy "C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Stylesheets\MdDlgContent.xsl" to the same folder as your script.

  2. Edit line 467 to remove STYLE="display:'none';", i.e. change:

    <DIV ID="{PropertyGroupName}" STYLE="display:'none';" onclick="window.event.cancelBubble = true;">
    

    to

    <DIV ID="{PropertyGroupName}" onclick="window.event.cancelBubble = true;">
    
  3. Then in your script tool properties, set the stylesheet property to your edited.xsl.

    enter image description here

7
  • how on this green earth would you find out this? I am flabbergasted. This is not so well documented! Feb 2, 2017 at 10:12
  • @Alex Modifying the stylesheet to customize a tool has been known about for a while. There's some old documentation here resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/… and a few questions here qnd on the Esri Geonet forum. Not sure if there's more up to date documentation. Once you know where to look, it's just a matter of figuring out what html/css needs changing.
    – user2856
    Feb 2, 2017 at 10:29
  • Sure, but it would take many trial & error attempts before being able to accomplish the task. Wish we had more updated docs on that... Thanks for posting the answer, absolutely brilliant. Feb 2, 2017 at 11:08
  • 1
    @Rex no, not using the xsl transform method. The categories are passed in reordered to begin with. I suggest the simple method of numbering your categories - self.params[0].category = "1. General" and self.params[2].category = "2. Inudaciones" etc...
    – user2856
    Feb 3, 2017 at 0:48
  • 1
    @ATCH_torn possibly but not easily. The category and non-category parameters are both styled in loops so you'd need to really customise the xsl rather than just changing one bit.
    – user2856
    Jul 30, 2018 at 20:28

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .