ImageEn, unit iexMetaHelpers

TIOParamsHelper.ReadFrom

TIOParamsHelper.ReadFrom


Declaration

function TIOParamsHelper.ReadFrom(ASource: TObject; MetaType: TIEMetaType): Boolean;


Description

Writes changes to meta-data values in a TListView or TStringGrid values back to a params object.
Result is true if the data has changed (meaning the file has changed and should be saved.
The control must have been filled using WriteTo.
Only iemEXIF and iemIPTC are supported. Other meta-types will raise an exception.



You can also use the in-built meta-data control, TIEMetaListView.

Note:
 A standard TListView does not permit editing of subitems, so either use TIEMetaListView, download a TListView descendent, or search for code snippets for "Edit Subitems TListView"
 MetaType cannot be iemDICOM. Use TIEMetaListView for Dicom tag editing
 ReadFrom is a Helper method. You must add iexMetaHelpers to your uses clause to access it
 Delphi/C++ 2005 or newer is required


Demos

Demo  Demos\InputOutput\Exif\Exif.dpr
Demo  Demos\InputOutput\Iptc\Iptc.dpr


Examples

// Display EXIF properties into a TStringGrid and allow user to edit them
ImageEnView1.IO.Params.WriteTo( StringGrid1, iemEXIF );
StringGrid1.Options := Options + [goEditing];
...
// Write changes to EXIF properties of the current image, and prompts the user to save changes if any fields were modified
if ImageEnView1.IO.Params.ReadFrom( StringGrid1, iemEXIF ) then
  PromptToSaveFile();

// Write changes to IPTC properties of the current image, and prompts the user to save changes if any fields were modified
if ImageEnView1.IO.Params.ReadFrom( ListView1, iemIPTC ) then
  PromptToSaveFile();

Compatibility Notes
ReadFrom replaces the following deprecated methods:
Old Method Old Code Example New Code Example
WriteGridToEXIF StringGrid1.WriteGridToEXIF( ImageEnView1.IO.Params ); ImageEnView1.IO.Params.ReadFrom( StringGrid1, iemEXIF );
WriteListToEXIF ListView1.WriteListToEXIF( ImageEnView1.IO.Params ); ImageEnView1.IO.Params.ReadFrom( ListView1, iemEXIF );
WriteGridToIPTC StringGrid1.WriteGridToIPTC( ImageEnView1.IO.Params ); ImageEnView1.IO.Params.ReadFrom( StringGrid1, iemIPTC );
WriteListToIPTC ListView1.WriteListToIPTC( ImageEnView1.IO.Params ); ImageEnView1.IO.Params.ReadFrom( ListView1, iemIPTC );
ReadListFromDicom ListView1.ReadListFromDicom( ImageEnView1.IO.Params, [ diProprietary, diChildTags ]); ImageEnView1.IO.Params.WriteTo( ListView1, iemDICOM, [ diProprietary, diChildTags ]);