Set a tool parameter category to be open by default in script of a .atbx toolbox.

154
2
Jump to solution
2 weeks ago
MattHowe
Occasional Contributor

Is it possible, perhaps in the validation script of a tool, to enable a category to be open by default on opening the tool? The user always has to expand the category to see the included parameters but I'd like to have it open by default.

MattHowe_0-1714125070630.png

 

0 Kudos
1 Solution

Accepted Solutions
EdMorris
Esri Contributor

Hi Matt

I think the behaviour of a Category is for it to be 'closed' by default. I think the reason is to save space on the form to hold optional arguments. As you are probably aware, optional arguments in the category should have a default value (where appropriate) and you should not include mandatory / required arguments.

Probably not the answer you were hoping for but it probably conforms your assumptions.

many thanks ed

View solution in original post

2 Replies
EdMorris
Esri Contributor

Hi Matt

I think the behaviour of a Category is for it to be 'closed' by default. I think the reason is to save space on the form to hold optional arguments. As you are probably aware, optional arguments in the category should have a default value (where appropriate) and you should not include mandatory / required arguments.

Probably not the answer you were hoping for but it probably conforms your assumptions.

many thanks ed

Luke_Pinner
MVP Regular Contributor

If the newer .atbx toolboxes can use a custom xsl stylesheet (I don't know...), then this old ArcGIS Desktop answer might be useful:

Controlling Categories in Script Validation Tools - Expanding Groups By Default

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.

     

    DMpHX