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.
Unfortunately, activation email could not send to your email. Please try again.

Multiple Undo/Redo with Formula cells

Thread ID:

Created:

Updated:

Platform:

Replies:

30835 Jun 24,2005 10:22 AM Jul 13,2005 07:06 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 24, 2005 10:22 AM

I am using the Grid Control v3.201.1.1 The default Undo/Redo works with formula cells, but you have to call Undo many times (at least one time for each affected formula cell) to undo one change. I have read your response to correct this problem by using transactions which are started and committed in the cellmove event. I have not been able to get this to work. It works fine to undo one change, but when there are multiple changes it does not seem to work. After the first transaction is rolled back, the CommandStack is no longer in a transaction even though the top item on the stack is another transaction. I have to manually undo the stack until I reach the next transaction, which works somewhat, but i think it defeats the purpose of the transactions. The redo does not work with this approach. My current approach is to enable the CommandStack on CurrentCellStartEditing, and disable it on CurrentCellEditingComplete. This works great for Undo, but the Redo does not work at all. I have tried to manually push the undo command to the RedoStack at the time of the Undo, and this will put items on the RedoStack, but when I Redo only cell moves are restored, not the cell value. I know I am not the only person with this problem. Would it be possible to get a sample of how to do this correctly? My test app has two formula cells. B1=A1+A2+A3, and C1=B1/2. I enter values in A1 through A3 to test undo/redo. Thanks Per

Administrator [Syncfusion]
Replied On June 24, 2005 03:44 PM

My approach of enabling the CommandStack only when I wish to record events works flawlessly for Undo with formula cells, including paste events that affect formula cells. The Redo however is not working at all with this approach. It moves the current cell around the grid for each Redo, but does not restore any data in the cells. >I am using the Grid Control v3.201.1.1 > >The default Undo/Redo works with formula cells, but you have to call Undo many >times (at least one time for each affected formula cell) to undo one change. > >I have read your response to correct this problem by using transactions which >are started and committed in the cellmove event. I have not been able to get this >to work. It works fine to undo one change, but when there are multiple changes >it does not seem to work. After the first transaction is rolled back, >the CommandStack is no longer in a transaction even though the top item on >the stack is another transaction. I have to manually undo the stack until >I reach the next transaction, which works somewhat, but i think it defeats the purpose >of the transactions. The redo does not work with this approach. > >My current approach is to enable the CommandStack on CurrentCellStartEditing, and >disable it on CurrentCellEditingComplete. This works great for Undo, but the >Redo does not work at all. I have tried to manually push the undo command to >the RedoStack at the time of the Undo, and this will put items on the RedoStack, >but when I Redo only cell moves are restored, not the cell value. > >I know I am not the only person with this problem. Would it be possible to >get a sample of how to do this correctly? > >My test app has two formula cells. B1=A1+A2+A3, and C1=B1/2. >I enter values in A1 through A3 to test undo/redo. > >Thanks > >Per

Administrator [Syncfusion]
Replied On June 25, 2005 05:05 AM

Checking our source code, the formula engine explicitly disables the CommandStack in two places. One is when references are adjusted after a formula has been moved (as in a copy/paste or row/col insert/remove) and the other is when dependent cells are being refreshed. I suspect this latter code is why your redo is not being performed. We will add a property to the engine to allow you to control whether the command stack is disabled. This may allow your technique to work. If you upload a little sample using your technique, we can try it here with the modifed library code to see if there is anything else we need to do to get it working.

Administrator [Syncfusion]
Replied On June 27, 2005 09:30 AM

Thanks for your response. I have attached my test project as you requested. If you have a suggestion for any other approach such as the transactions you have mentioned before I’d be interested to give that another try. Like I mentioned before, I was not able to make it work, but I may have been doing something wrong. What is the time frame to get the fix you mentioned, assuming that my technique works with it? Thanks for your help! Per >Checking our source code, the formula engine explicitly disables the CommandStack in two places. One is when references are adjusted after a formula has been moved (as in a copy/paste or row/col insert/remove) and the other is when dependent cells are being refreshed. I suspect this latter code is why your redo is not being performed. > >We will add a property to the engine to allow you to control whether the command stack is disabled. This may allow your technique to work. If you upload a little sample using your technique, we can try it here with the modifed library code to see if there is anything else we need to do to get it working. PerUndo_8597.zip

Administrator [Syncfusion]
Replied On July 11, 2005 05:51 PM

Clay, Did you have a chance to look at this yet? Thanks, Per >Thanks for your response. I have attached my test project as you requested. > >If you have a suggestion for any other approach such as the transactions you have mentioned before I’d be interested to give that another try. Like I mentioned before, I was not able to make it work, but I may have been doing something wrong. > >What is the time frame to get the fix you mentioned, assuming that my technique works with it? > >Thanks for your help! > >Per > > > >>Checking our source code, the formula engine explicitly disables the CommandStack in two places. One is when references are adjusted after a formula has been moved (as in a copy/paste or row/col insert/remove) and the other is when dependent cells are being refreshed. I suspect this latter code is why your redo is not being performed. >> >>We will add a property to the engine to allow you to control whether the command stack is disabled. This may allow your technique to work. If you upload a little sample using your technique, we can try it here with the modifed library code to see if there is anything else we need to do to get it working. > >PerUndo_8597.zip > >

Administrator [Syncfusion]
Replied On July 12, 2005 08:31 AM

Per, Sorry for the delay. I will update this later today or tomorrow. Clay

Administrator [Syncfusion]
Replied On July 13, 2005 07:06 AM

Here is your sample back. I think I was able to get the user changing cells redo/undo to work back and forth using your idea of turning the CommandStack on and off as the cell is actively being edited. I think the main problem was the undo information was pointing to the wrong cell. To get things working, I added a derived SyncfusionCommand class (ChangeCells) that is used for the commands that are added to the Redo stack so that things are pointed at the proper cell. http://www.syncfusion.com/Support/user/uploads/PerUndo_1d62ba99.zip In the long run, we will have to make adjustments to the undo/redo/formulaengine classes to handle undo/redo support in the formulaengine.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;