ImageEn, unit imageenview

TIENewLayerEvent


Declaration

TIENewLayerEvent = procedure(Sender: TObject; LayerIdx: integer; LayerKind: TIELayerKind) of object;


Description

Occurs whenever a layer is added. It is useful to assign default properties to the layer.
Both programmatic methods (e.g. using LayersAdd) and user methods (e.g. using mlCreateShapeLayers) trigger this event.

LayerIdx is the index of the new layer.
LayerKind is the kind of layer that was added.

Note:
CurrentLayer will represent the new layer
To capture the new layer after user has completed sizing and positioning it, use the OnLayerNotifyEx event
Unlike ielNewLayer of the OnLayerNotifyEx event, OnNewLayer is called even for layers added programmatically


Examples

procedure Tfmain.ImageEnView1NewLayer(Sender: TObject; LayerIdx: Integer; LayerKind: TIELayerKind);
begin
  // Assign default properties for new objects
  case LayerKind of
    ielkPolyline : TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesExplosion, True );
    ielkText     : TIETextLayer( ImageEnView1.CurrentLayer ).Text := 'Double-click to edit text';
  end;
end;

// Make new shape layer a red star
procedure TfrmMain.ImageEnView1NewLayer(Sender: TObject; LayerIdx: integer; LayerKind: TIELayerKind);
begin
  if LayerKind = ielkShape then
  begin
    TIEShapeLayer( ImageEnView1.CurrentLayer ).Shape := iesStar5;
    TIEShapeLayer( ImageEnView1.CurrentLayer ).FillColor := clRed;
  end;
end;


See Also

OnNewLayer