ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Undo events?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Sep 14 2017 : 04:19:18
When the user has returned to the beginning of the Undo chain by doing repeated Undo (so there are not any more changes left to Undo), how can I get notified?

There are no Undo events in TImageEnView to notify me about the current position in the Undo chain when the user undoes a change.

Generally, I prefer being notified instead of having to ask.
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 18 2017 : 16:50:13
Hi

Ctrl-Z? So, are you using a TImageEnViewUndo action?

What type of method is being undone?





Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
PeterPanino Posted - Sep 18 2017 : 09:01:36
I work with CodeSite which gives me an exact feedback from what happens at run-time.

1. Place a CodeSite.Send in the OnImageChange event-handler:

procedure TFormMain.imgImportEditorImageChange(Sender: TObject);
begin
  CodeSite.Send('TFormMain.imgImportEditorImageChange: test');  
end;


2. Then I press Ctrl-Z (on my German keyboard) ONCE to Undo a previous Edit action.

3. In the CodeSite Live Viewer you can see that the OnImageChange event-handler has been called twice (in a time-distance of 3 milliseconds):

xequte Posted - Sep 17 2017 : 20:13:53
Hi Peter

I cannot reproduce the duplicate OnImageChange call. Can you give me more info.

You can email us for a pre-release which includes OnUndoRedo.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
PeterPanino Posted - Sep 16 2017 : 16:05:02
Hi Nigel,

1. any Undo de facto calls the OnImageChange event-handler TWICE which is inefficient and could lead to logical contradictions (if you do other things in this event-handler).

2. Also the fact that both image-processings and Undo call the OnImageChange event-handler could lead to logical contradictions and thus unwanted effects.

Considering this I think an OnUndoRedo event would make sense because it would allow reacting only to changes in the Undo chain and thus handling these changes more consistently.
xequte Posted - Sep 14 2017 : 22:26:29
Hi

I'll add an OnUndoRedo event in the next update, but you can just use the OnImageChange event:

procedure TForm1.ImageEnView1ImageChange(Sender: TObject);
begin
  // Update status of buttons
  btnSave.Enabled := ImageEnView1.IEBitmap.Modified;
  btnUndo.Enabled := ImageEnView1.Proc.CanUndo;
  btnRedo.Enabled := ImageEnView1.Proc.CanRedo;
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
PeterPanino Posted - Sep 14 2017 : 12:35:08
Bill, thank you for the answer.

I strongly suggest implementing an EVENT OnUndoRedo which contains as parameters:

• UndoAction: Boolean (if True, the user has made an Undo, if False, the user has made a Redo)

• var UndoPos: Integer (current position in the Undo chain; if 0, there is nothing to Undo)

This is much better and more efficient and more logical and more useful than having explicitly to ask for this information!

PLEASE!
w2m Posted - Sep 14 2017 : 10:09:09
procedure TForm1.UndoClick(Sender: TObject);
begin
  If ImageEnView1.Proc.CanUndo then
  begin
    ImageEnView1.Proc.Undo;
    ImageEnView1.Proc.ClearUndo;
  else
    ShowMessage('Nothing to Undo!');
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development