ImageEn, unit imageenview |
|
TIELayerNotify
Declaration
TIELayerNotify = procedure(Sender: TObject; layer: integer; event: TIELayerEvent) of object;
Description
layer is the layer index that is affected. WARNING:
layer may not be a valid index (-1 or a removed index for some event types).
event specifies the event type:
Value | Description |
ielSelected | User selected the layer |
ielDeselected | User deselected the layer |
ielBeginResizing * | User began to resize the layer (click down) |
ielResizing | User is resizing the layer |
ielResized | User finished resizing the layer |
ielBeginMoving * | User began to move the layer (click down) |
ielMoving | User is moving the layer |
ielMoved | User finished moving the layer |
ielBeginRotating * | User began to resize the layer (click down) |
ielRotating | User is rotating the layer |
ielRotated | User has finished rotating the layer |
ielBeginCreating * | Occurs as the user starts to create a layer using the mouse (dragging or clicking points). Layer index will be -1 |
ielCreating | User is creating a layer using the mouse (dragging or clicking points) |
ielNewLayer | A new layer has been added by the user (but unlike ielCreated, may not have finished sizing it). This is the similar to the OnNewLayer event |
ielCreated | After a user had finished adding a new layer |
ielAddedPoint | User has added a point to a polyline layer |
ielMovedPoint | User is moving a point of a line or polyline layer |
ielEditedPoints | User has edited the points of a line or polyline layer |
ielEditedProps | User edited the properties of a layer, e.g. using the Layer Properties dialog |
ielEdited | User edited the text of a layer |
ielTextEditorClick | User has clicked the mouse or keyboard in the text editor for a TIETextLayer or TIELineLayer |
ielTextEditorChange | User has changed the mouse or keyboard in the text editor for a TIETextLayer or TIELineLayer (called for every change. Use ielEdited to detect once editing has completed) |
ielBeforeRemove * | Occurs before a layer is deleted due to a user action |
ielRemoved * | User has deleted a layer |
ielLeftClicked | User has clicked on a layer with the left mouse button (mouse up) |
ielRightClicked | User has clicked on a layer with the right mouse button (mouse up) |
ielDblClicked | User has double-clicked on a layer (Note: Does not occur for layer 0 unless LayerEditingMode is enabled) |
ielMouseOver | User has moved the cursor over a layer (Other than layer 0) |
ielArranged | User is changing the arrangement of layers (e.g. bringing a layer in front of another) |
ielMerged | User has merged layers (using an ImageEn Action) |
ielGrouped | User has grouped or ungrouped layers (using an ImageEn Action) |
ielAction | User has used an ImageEn Action that has changed the layers |
* Does not occur with
OnLayerNotifyNote:
◼This event only occurs once for each change, even if
multiple layers are selected. You should review the list of selected layers to determine which changed
◼ielBeginCreating will return -1 as an index
◼ielBeforeRemove may return layer as LYR_ALL_LAYERS (-3) or LYR_SELECTED_LAYERS (-2)
◼ielRemoved will return an index for a layer that has been removed
| Demos\LayerEditing\StampTextAndShapes\StampLayers.dpr |
// Log all resizing of layers
procedure TfrmMain.IEView1LayerNotifyEx(Sender: TObject; layer: integer; event: TIELayerEvent);
var
ALayer: TIELayer;
i: Integer;
sChangedLayers: string;
begin
if event = ielResized then
begin
sChangedLayers := '';
for i := 0 to IEView1.LayersCount - 1 do
begin
ALayer := IEView1.Layers[ I ];
if ( ALayer.Locked = False ) and ALayer.Selected then
sChangedLayers := sChangedLayers + IntToStr( i ) +',';
end;
if sChangedLayers <> '' then
begin
SetLength( sChangedLayers, Length( sChangedLayers ) - 1 ); // Remove final comma
memLog.Lines.Add( 'Layers Resized: ' + sChangedLayers );
end;
end;
end;
// Auto-size text only after rotation
procedure TMainForm.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
if ( ImageEnView1.Layers[ layer ] is TIETextLayer ) and ( event is ielRotated ) then
begin
TIETextLayer( ImageEnView1.Layers[ layer ]).SizeToText();
ImageEnView1.Update();
end;
end;
// Refresh layer viewer (see TImageEnMView.AssignLayers) for any events that change the layers list, or the way layers look
procedure TMainForm.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
if event in [ ielSelected, ielDeselected, ielMoved, ielResized, ielRotated, ielCreated, ielMerged, ielGrouped, ielAction, ielEdited, ielEditedProps, ielEditedPoints, ielRemoved, ielArranged ] then
RefreshLayerViewer();
end;
// Automatically merge added layers to the background (e.g. "Select to draw" shapes onto image)
procedure Tfmain.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
if AutoMergeLayers and ( layer >= 0 ) and ( layer < ImageEnView1.LayersCount ) then // Ensure it is a valid layer
begin
// For text layers with automatic text editing (loAutoTextEditing in LayerOptions) don't merge till we complete editing
if (( ImageEnView1.Layers[layer].Kind = ielkText ) and ( event = ielEdited )) or
(( ImageEnView1.Layers[layer].Kind <> ielkText ) and ( event = ielCreated )) then
ImageEnView1.LayersMerge( 0, layer );
end;
end;