ImageEn, unit iexLayerProps

TIELayerProps


Declaration

TIELayerProps = class(TWinControl);


Description

TIELayerProps is a TWinControl which shows properties of a layer. It is also used in the dialog when LayersShowPropertiesDialog is called.




Demo

Demo  \Demos\Actions\Actions_Layers\LayerActions.dpr


Examples

// Display properties of the selected layer in a TImageEnView
IELayerProps1.AttachedImageEnView := ImageEnView1;

// Display properties of the layer 2
IELayerProps1.AttachedImageEnView := ImageEnView1;
IELayerProps1.LayerIndex := 2;

// Cancel any recent changes to layer properties
IELayerProps1.CancelChanges();


Layer Properties Form Example

// Example of a custom form that shows properties of a layer
// Also see: ImageEnView1.LayersShowPropertiesDialog();
// Create a form containing:
// - TIELayerProps
// - OK button with ModalResult = OK
// - Cancel button with ModalResult = mrCancel
function TMyForm.LayersShowPropertiesDialog(): Boolean;
var
  dlg : TMyLayerPropsDlg;
  lyrIdx: Integer;
begin
  lyrIdx := ImageEnView1.LayersCurrent;

  dlg := TMyLayerPropsDlg.Create( Self );
  try
    dlg.IELayerProps1.AttachedImageEnView := ImageEnView1;
    dlg.IELayerProps1.LayerIndex := lyrIdx;

    Result := dlg.ShowModal <> mrCancel;
    if Result = False then
      dlg.IELayerProps1.CancelChanges();
  finally
    FreeAndNil( dlg );
  end;
end;


New Layer Properties Example 2

// Example of a custom form that allows setting properties of a new layer
// Note: The new layer is created before the dialog is shown, and removed if user clicks cancel
// Use ImageEnView1.LockUpdate/UnlockUpdate if the new layer should not be visible
// Also see: ImageEnView1.LayersNewLayerDialog();
// Create a form containing:
// - TIELayerProps
// - OK button with ModalResult = OK
// - Cancel button with ModalResult = mrCancel
function TMyForm.LayersNewLayerDialog(LayerKind: TIELayerKind): Boolean;
var
  dlg : TMyLayerPropsDlg;
  lyrIdx: Integer;
begin
  // Append the new layer
  lyrIdx := LayersAppend( LayerKind );

  // Add any default props...

  dlg := TMyLayerPropsDlg.Create( Self );
  try
    dlg.IELayerProps1.AttachedImageEnView := ImageEnView1;
    dlg.IELayerProps1.LayerIndex := lyrIdx;
    dlg.IELayerProps1.HeadingMode := iehCustom;
    dlg.IELayerProps1.Heading := format( 'Create a new %s layer:', [ ImageEnView1.CurrentLayer.KindStr() ]);

    Result := dlg.ShowModal <> mrCancel;
    if Result = False then
      LayersRemove( lyrIdx );
  finally
    FreeAndNil( dlg );
  end;
end;


Methods and Properties

Public Method  ApplyChanges
Published Property  AttachedImageEnView
Public Method  CancelChanges
Published Property  ComboBoxShapeColor
Published Property  ComboBoxShowText
Published Property  GradientColor1
Published Property  GradientColor2
Published Property  Heading
Published Property  HeadingMode
Public Property  LayerIndex
Published Property  ShowAdvanced
Published Property  StrictSelection


Events

Event  OnCreate
Event  OnDestroy
Event  OnUpdate