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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Undo an AddNewObject
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

c.basso

Italy
36 Posts

Posted - May 27 2015 :  01:52:39  Show Profile  Reply
Hi,

I'm using a TImageEnVect with AutoUndo set to true.
All operations of undo/redo works well,
but if I create at runtime an object:
idx1:= AddNewObject;
ObjKind[idx1]:= iekLINE;
ObjPenColor[idx1]:= clBlack;
...

The undo stack doesn't change.

I've tried to call SaveUndo before creating object, nothing changes (the undo stack increase, but if I undo, my object is not removed).
I've tried to set autoundo = false and call saveundo, no luck.

What's the procedure to undo the AddNewObject method?

Thanks
Claudio BAsso

Claudio

xequte

38514 Posts

Posted - May 27 2015 :  05:21:40  Show Profile  Reply
Hi Claudio

AutoUndo, SaveUndo, etc are for undo/redo of TImageEnView image and layer changes.

For TImageEnVect object changes use the ObjAutoUndo and the other Obj*Undo properties and methods.

http://www.imageen.com/help/TImageEnVect.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

c.basso

Italy
36 Posts

Posted - May 27 2015 :  06:17:42  Show Profile  Reply
Ok, solved using objsaveundo before AddNewObject.

Now I have 2 undo stack, one for image, one for vect objects,
if I want that the user has only 1 "Undo" button, how can I know what is the last action?
How can I know if I have to call Proc.Undo or ObjUndo?

To explain better:
I'm set the undo object like this:
Proc.AutoUndo:= True;
Proc.UndoLimit:= 10;
ObjAutoUndo:= True;
ObjUndoMode:= ieumShared;

If I create a line with mouse, I can undo the action with the Undo command, but if I use ObjSaveUndo, I must use ObjUndo to come back, the Undo command does nothing.

In that manner, when user clic on my Undo button, I can't know if last action was automatically put in Undo stack or if I must call ObjUndo.

Thanks

Claudio
Go to Top of Page

xequte

38514 Posts

Posted - May 29 2015 :  04:32:53  Show Profile  Reply
Hi

If you set ObjUndoMode to ieumShared then the object and proc undo are shared, so use Proc.undo to undo both types of change. Do not use ObjUndo.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: