Skip to main content
A newer version of this page is available. .

TdxMapItems.Add(TdxMapItemClass) Method

Creates a map item of a specified type and appends it to the collection.

Declaration

function Add(AMapItemClass: TdxMapItemClass): TdxMapItem;

Parameters

Name Type
AMapItemClass TdxMapItemClass

Returns

Type
TdxMapItem

Remarks

AMapItemClass specifies the class of map item to be created. Pass any of the built-in map item classes listed in the TdxMapItem class description or a custom one (a TdxMapItem descendant) as this parameter. The created map item is returned as the function’s result.

The following code example shows how to create an item layer, add a pushpin to it using the Add method, and specify the pushpin’s label text.

uses
   ..., dxMapItemLayer, dxMapItem;
var
  AMapItemLayer: TdxMapItemLayer;
  APushpin: TdxMapPushpin;
begin
  AMapItemLayer := <dxMapControl>.AddItemLayer();
  APushpin := TdxMapPushpin(AMapItemLayer.MapItems.Add(TdxMapPushpin));
  APushpin.Text := 'You are here';
end;
See Also