User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_layervector.addfield_string_tgis_fieldtype_integer_integer

Table of Contents

TGIS_LayerVector.AddField method

DK11 for Delphi | GisLayerVector.TGIS_LayerVector.AddField | Constructors | Fields | Methods | Properties | Events

Add a new field.

Available also on: .NET | Java | ActiveX.

Syntax

// 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
  );

Parameters

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;

Remarks

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).

References

2018/10/26 17:52