Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Access details of Undo / Redo
posted

Hi

I'm writing a simple application that connects a WinGrid to a database table (via an EntitySpaces business object) and allows the user to update, edit and delete records.

I have almost all the functionality in place but one other thing I am doing is keeping a count of each change, delete and insert to display to the user at the top of the screen and it is also used to determine if the Save, Undo or Redo buttons are enabled. I also highlight the changed cells / inserted rows or not, to show what has changed.

The problem is that I need to know what the Undo / Redo 'events' are changing so that I can change my totals / (un)highlight cells accordingly, and if there is nothing to Undo / Redo, disable the relevant button(s).

I'm using the following commands in my Undo / Redo button OnClick event handlers:

   myGrid.PerformAction(UltraGridAction.Undo);

   myGrid.PerformAction(UltraGridAction.Redo);

However, I can't find any events related to something like OnUndo / OnRedo to intercept what is being changed so I can decrease / increase my totals accordingly.

Also I'm using the 'AfterCellUpdate', 'AfterRowInsert' and 'AfterRowsDeleted' event handlers to increment my totals but they also get updated after the Undo / Redo as I don;t know the logic needed to check if its an Undo taking place.

Some object must be keeping track of the changes for the Undo / Redo to work, but I can't seem to find it. 

Can anyone help?

Cheers