ImageEn, unit iexMetaHelpers

TIEEditMetaEvent


Declaration

TIEAddMetaEvent = procedure(Sender: TObject; MetaType: TIEMetaType; RecIndex, DataIndex: Integer;
                            var Value: string; var AllowEdit: Boolean) of object;


Description

Used by OnEditMetaData and OnSaveMetaData.
Modify Value to change the text that is offered to the user/saved to params.
Set AllowEdit to False to prevent editing of the item.

RecIndex is only used by iemIPTC and iemDICOM, for other values it will be 0.

For DataIndex:
Value Description
iemGeneral General Tag Constants
iemEXIF Constants for EXIF Properties
iemIPTC PhotoShop IPTC Constants
iemDicom Dicom Tags Supported by ImageEn
iemXMP Constants for Common XMP Fields
iemPDF Constants for PDF Properties


OnEditMetaData Examples

procedure TMainForm.IEMetaListView1EditMetaData(Sender: TObject; MetaType:
    TIEMetaType; RecIndex, DataIndex: Integer; var Value: string; var
    AllowEdit: Boolean);
begin
  // Only allow editing of EXIF "User Comment" and "Description" fields
  AllowEdit := ( MetaType = iemEXIF ) and ( DataIndex in [ _EXIF_UserComment, _EXIF_ImageDescription ]);
end;

procedure TMainForm.IEMetaListView1EditMetaData(Sender: TObject; MetaType:
    TIEMetaType; RecIndex, DataIndex: Integer; var Value: string; var
    AllowEdit: Boolean);
begin
  // Fix casing when editing values
  Value := TitleCase( Value );
end;


OnSaveMetaData Examples

procedure TMainForm.IEMetaListView1SaveMetaData(Sender: TObject; MetaType:
    TIEMetaType; RecIndex, DataIndex: Integer; var Value: string; var
    AllowEdit: Boolean);
begin
  // Require a value to be specified for the EXIF "Description" field
  if ( MetaType = iemEXIF ) and ( DataIndex = _EXIF_ImageDescription ) and ( Value = '' ) then
  begin
    MessageDlg( 'You must specify a value for the EXIF Description', mtError, [ mbOK ], 0 );
    AllowEdit := False;
  end;
end;

procedure TMainForm.IEMetaListView1SaveMetaData(Sender: TObject; MetaType:
    TIEMetaType; RecIndex, DataIndex: Integer; var Value: string; var
    AllowEdit: Boolean);
begin
  // If the user has specified all lower case text, then convert it to title case
  if Value = Lowercase( Value ) then
    Value := Titlecase( Value );
end;