I'm creating a custom tool for arcmap toolbox where user select FeatureLayer in one combobox, and in next combobox user can select a field from selected FeatureLayer. FeatureLayer combobox fills automaticaly from:
...
inputParameter.DataType = (IGPDataType)new GPFeatureLayerTypeClass();
inputParameter.Value = (IGPValue)new GPFeatureLayer();
The problem arises when I need to fill field combobox. I'm not realy sure how to set up its parameters. right now i'm trying something like this:
inputParameter = new GPParameterClass();
inputParameter.Enabled = true;
inputParameter.Name = "FieldTrg";
inputParameter.DisplayName = "Feature Class Fields";
inputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput;
inputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired;
inputParameter.DataType = (IGPDataType)new GPStringType();
inputParameter.Value = (IGPValue)new GPString();
//inputParameter.AddDependency("FeatureClassTrg");
//IGPFeatureSchema fgs = new GPFeatureSchemaClass();
//fgs.FieldsRule = esriGPSchemaFieldsType.esriGPSchemaFieldsAll;
//inputParameter.Schema = (IGPSchema)fgs
In UpdateParameters function I were able to get fields in selected FeatureLayer/FeatureClass, but I had no idea where and how should I put them back in combobox. Also currently the field 'combobox' isn't really a combobox, but just a string field, so probably GPString isn't corect thing to use as its DataType/Value.
Any help regarding this problem would be appreciated.