Parameter controls

Every geoprocessing parameter includes a default control. This is the default appearance of the parameter in the Geoprocessing pane. The control is a reflection of the data type, and whether the parameter accepts one or many values. The geoprocessing framework supports a limited number of controls that allow you to modify the control in the Geoprocessing pane.

In a script tool or Python toolbox tool, the default control can be overridden using the Parameter object's controlCLSID property.

In a script tool, unlike most other parameter properties, a control cannot be modified from the Tool Properties dialog box and must be set in the validation code. Set controlCLSID in the tool's ToolValidator class in the __init__ method.

def __init__(self):
    self.params = arcpy.GetParameterInfo()
    self.params[1].controlCLSID = '{15F0D1C1-F783-49BC-8D16-619B8E92F668}'

In a Python toolbox, set controlCLSID after defining the parameter in the tool class's getParameterInfo method.

extent = arcpy.Parameter(
    displayName='Extent',
    name='Extent',
    datatype='GPExtent',
    parameterType='Required',
    direction='Input')
extent.controlCLSID = '{15F0D1C1-F783-49BC-8D16-619B8E92F668}'

Extent

The default control for the Extent data type appears as follows:

Default Extent control with the Intersect and Union of Inputs buttons

Change the control to the following using a controlCLSID value of {15F0D1C1-F783-49BC-8D16-619B8E92F668}. This control excludes the Intersect button Intersection and Union of Inputs button Agréger.

Extent control with without the Intersect and Union of Inputs buttons

Numeric (Long and Double)

The default control for the Long and Double data types, with the Range filter appears as follows:

Default multivalue Long control

Add a slider bar to the parameter using a controlCLSID value of {C8C46E43-3D27-4485-9B38-A49F3AC588D9}.

Long multivalue control with a slider control

The default control for the Long and Double data types appears as follows:

Default Long control

For a left-oriented and larger text box, use a controlCLSID value of {7A47E79C-9734-4167-9698-BFB00F43AE41}.

Long control with a longer text box

Composite

A Composite data type is a parameter that combines at least two data types. In the following example, the Composite data type is composed of Linear Unit and Field data types. The control is based on the first data type, often making it difficult to accurately add a value for the other data types.

Composite control with Linear Unit and Field data types

Change the control to the following using a controlCLSID value of {BEDF969C-20D2-4C41-96DA-32408CA72BF6}. This control provides a choice list that allows you to switch the control from one data type to another, making it easier to provide a value for any of the data types the parameter uses.

Composite control with a choice list

String

The String data type is commonly used to support a set of keywords. The default control for the String data type appears as follows:

Default String control

To support a parameter that accepts a multiline block of text, use a controlCLSID value of {E5456E51-0C41-4797-9EE4-5269820C6F0E}.

String control with a larger text box

Multivalue

The default control for a multivalue String, Field, Long, and Double data type with a Value List filter appears as follows:

Default multivalue control

To support a parameter that accepts a choice list of options, use a controlCLSID value of {172840BF-D385-4F83-80E8-2AC3B79EB0E0}.

Multivalue control with check boxes for the options

Similarly, to create a parameter that accepts a choice list of options, and includes a Select All button, use a controlCLSID value of {38C34610-C7F7-11D5-A693-0008C711C8C1}.

Multivalue control with the Select All button and check boxes for the options

Feature Layer

The default control for the Feature Layer data type appears as follows:

Default Feature Layer control

A Feature Layer data type supports both feature classes and feature layers as input. To also support feature sets, use a controlCLSID value of {60061247-BCA8-473E-A7AF-A2026DDE1C2D}. When using the tool, click the edit button Mise à jour to interactively create features for input to the tool.

Feature Layer control with the edit button

Remarque :

Use the Feature Set data type to create the same effect.

Value Table

By default, when a parameter with a Value Table data type has three or more columns, the columns are organized vertically.

Default Value Table control with three vertical columns

For a horizontal orientation, use a controlCLSID value of {1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}.

Value Table control with three horizontal columns

By default, a Value Table data type accepts multiple sets of values, or rows. In some cases, it may be preferable to limit the parameter to a single set of values. To limit a Value Table data type to a single set of values by removing the Add another button Ajouter, use a controlCLSID value of {1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}.

Value Table control without the Add another button