We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Implementation of Undo

Hi, I have a windows Forms application that uses Syncfusion. On doing a Insert of a Symbol into the diagram, I do create the symbol in the Diagram area using the Syncfusion API as well as set some properties globally for the Symbol plus insert some related data into the database. I have to implement Copy, Paste and Undo in this application. For example, When I am selecting the symbol from the diagram and pasting it in the diagram area again, it should do the following a. It should create the Symbol in the Diagram area in the pasted position b. It should set the properties globally c. It should write into the database Similarly when I do an Undo, it should the do the following a. It should undo the drawing of Symbol in the diagram area b. It should remove the properties for that symbol that was set globally c. It should remove the entry for the relevant symbol from the database Can you let me know how these could be done ? Rgds, Andy

1 Reply

AD Administrator Syncfusion Team November 17, 2005 02:59 PM UTC

Hello Andy, Essential Diagram has built-in support for Undo/Redo and copy/paste operations. Copy/paste can be implemented by responding to the appropriate keyboard events and summoning the Diagram.Controller.Cut/Copy/Paste methods. Please refer to the ''barItemEditCut_Click'', ''barItemEditCopy_Click'' and ''barItemEditPaste_Click'' methods in the MainForm.cs file of the InDepth\DiagramBuilder sample to view the diagram clipboard copy/paste API. In the case of a copy the new node will be a clone of the original node and will thus contain all properties of the original. As for undo/redo of the copied nodes, this is automatically supported when using the diagram controller''s cut/copy/paste methods as shown in the sample. For your database I/O, the best way to get notifications of node insertion/removal is by handling the Diagram.ChildrenChanging and ChildrenChangeComplete events. These events will be raised in response to cut/paste operations, and examining the event arguments will let you determine the involved node(s) and the ensuing operation. I hope this helps. Please let us know if you require further assistance on this issue. Regards, Prakash Surendra Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon