Hi
Documentation is at:
https://www.imageen.com/help/TImageEnView.OnUndoRedo.html
But it is lacking detail and an example. I will update it for the next release.
TImageEnProc.OnUndoRedo
Declaration
property OnUndoRedo: TIEOnUndoRedoEvent;
Description
Occurs before TImageEnProc.Undo or TImageEnProc.Redo is called by user action or your code to allow the undo/redo processing to be customized.
*Source* is the same parameter used when calling TImageEnProc.SaveUndo.
*iIndex* is only used with <A TImageEnMView> and specifies the index of the image being undone/redone.
*UndoObj* contains the object that will be applied. The type depends on the *Source*:
- ieuImage: Obj is a TIEBitmap
- ieuSelection: Obj is a >memory stream of the selection
- ieuLayer, ieuFullLayer: Obj is a memory stream of the object
- ieuObject, ieuObjectsAndLayers: Obj is a memory stream of the object
Set *Handled* if you perform the undo/redo operation yourself (to prevent ImageEn from applying any change).
Note: You can check for iecsUndo in the TImageEnView.OnImageChangeE> event to detect changes due to undo/redo
Example
// Supply our own image on "Undo"
procedure TfrmMain.ImageEnView1UndoRedo(Sender: TObject; bIsUndo: Boolean; Source:
TIEUndoSource; UndoObj: TObject; iIndex: Integer; var Handled: Boolean);
begin
If bIsUndo and ( Source = ieuImage ) then
begin
TIEBitmap( UndoObj ).LoadFromFile( 'C:\Undo.bmp' );
Handled := False; // Because we still want this undo object to be processed
end;
end;
// Which is the same as...
procedure TfrmMain.ImageEnView1UndoRedo(Sender: TObject; bIsUndo: Boolean; Source:
TIEUndoSource; UndoObj: TObject; iIndex: Integer; var Handled: Boolean);
begin
If bIsUndo and ( Source = ieuImage ) then
begin
ImageEnView1.IEBitmap.LoadFromFile( 'C:\Undo.jpg' );
Handled := True; // Because we have handled it ourselves
end;
end;
Nigel
Xequte Software
www.imageen.com