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:
Change the control to the following using a controlCLSID value of {15F0D1C1-F783-49BC-8D16-619B8E92F668}. This control excludes the Intersect button and Union of Inputs button .
Numeric (Long and Double)
The default control for the Long and Double data types, with the Range filter appears as follows:
Add a slider bar to the parameter using a controlCLSID value of {C8C46E43-3D27-4485-9B38-A49F3AC588D9}.
The default control for the Long and Double data types appears as follows:
For a left-oriented and larger text box, use a controlCLSID value of {7A47E79C-9734-4167-9698-BFB00F43AE41}.
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.
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.
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:
To support a parameter that accepts a multiline block of text, use 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:
To support a parameter that accepts a choice list of options, use 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}.
Feature Layer
The default control for the Feature Layer data type appears as follows:
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 to interactively create features for input to the tool.
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.
For a horizontal orientation, use a controlCLSID value of {1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}.
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 , use a controlCLSID value of {1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}.
Vous avez un commentaire à formuler concernant cette rubrique ?