DK11 for Delphi | GisLayerVector.TGIS_LayerVector.AddField | Constructors | Fields | Methods | Properties | Events
Adds a new field.
// Delphi public procedure AddField( const _name : String; const _type : TGIS_FieldType; const _width : Integer; const _decimal : Integer ); virtual;
// C++ Builder public: virtual void AddField( const UnicodeString _name, TGIS_FieldType* const _type, const int _width, const int _decimal );
Name | Type | Description |
---|---|---|
_name | String | name of field to be added |
_type | TGIS_FieldType | type of field |
_width | Integer | width of field; not important for fields other then TGIS_FieldType.Number or TGIS_FieldType.String; |
_decimal | Integer | decimal places; not important for fields other then TGIS_FieldType.Number; |
Use this method to add a new field that will be marked as added and the final restructure will be performed on save. Unadd can be performed by RevertAll.
For TGIS_FieldType.String a _width will be treated as a hint. Value can represent any length but will be truncated on saving to the length defined in a current layer type. For example in TGIS_LayerSHP it will be truncated to 254 characters; in TGIS_LayerSQL will be truncated to the length defined in a database (defined on creation).
For TGIS_FieldType.Number a _width and a _decimal will be treated as a hint. Value can represent any float but will be truncated on save to the length limited in a current layer type. For example in TGIS_LayerSHP it will be truncated to exact _width & _precision value; in TGIS_LayerSQL will be stored as a float or Integer field (if _decimal = 0).