Parameter controls

Every geoprocessing parameter comes with a default control. That 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 seen 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 within the validation code. Set the controlCLSID in the tool's ToolValidator class within the __init__ method.

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

In a Python toolbox, set the 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

Change the control to the following using a controlCLSID value of {15F0D1C1-F783-49BC-8D16-619B8E92F668}.

Extent control with a controlCLSID value of {15F0D1C1-F783-49BC-8D16-619B8E92F668}

Numeric (Long and Double)

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

Default multivalue Long control

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

Long multivalue control with a controlCLSID value of {C8C46E43-3D27-4485-9B38-A49F3AC588D9}

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 controlCLSID value of {C8C46E43-3D27-4485-9B38-A49F3AC588D9}

Composite

A Composite data type is a parameter that combines at least two data types. In the following example, the Composite data type is comprised 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 provide 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 Linear Unit and Field data types and a controlCLSID value of {BEDF969C-20D2-4C41-96DA-32408CA72BF6}

String

The String data type is commonly used to support a set of keywords. The default control for the Extent 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 controlCLSID value of {E5456E51-0C41-4797-9EE4-5269820C6F0E}

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 a controlCLSID value of {172840BF-D385-4F83-80E8-2AC3B79EB0E0}

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 a controlCLSID value of {38C34610-C7F7-11D5-A693-0008C711C8C1}

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 interactive input button 編集 to interactive create features for input to the tool.

Feature Layer control with a controlCLSID value of {60061247-BCA8-473E-A7AF-A2026DDE1C2D}

注意:

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