tags:

views:

38

answers:

2

I m trying with the Redo option, I have written the following code for Redo but insted of Redo Undo is working for the same. Please guide me where i went wrong. My code sample is.....

void EIWBDoc::OnEditRedo() //for REDO.
{
 // TODO: Add your command handler code here
   int Index = m_FigArray.GetUpperBound ();
   if (Index > -1) 
   {
      delete m_FigArray.GetAt(Index); 
      m_FigArray.RemoveAt (Index); 
   }
   UpdateAllViews (0);
   SetModifiedFlag ();
}

void EIWBDoc::OnUpdateEditRedo(CCmdUI* pCmdUI) //for redo.
{
   // TODO: Add your command update UI handler code here
   pCmdUI->Enable (m_FigArray.GetSize ());   

}

i m storing all the deleted means the Undo contents into one array.Now i need to call the same into my Redo(). How should i do?

+1  A: 

From this small snippet, it looks like you are removing the last 'fig' to have been added. This sounds more like an 'undo' behaviour.

I suspect that you want to add the last 'fig' to have been 'undone', having stored it in your 'undo' method.

Your command enabler will need to only enable 'redo' functionality when there is something to be 'redone', not when there are 'figs' in your document.

Johnsyweb
+1  A: 

hey thanks.. but i m not getting how to store the previously selected value and retrive the same when Redo is clicked. Can you please guide me how can i store the values and retriving them with the same code....

Suhani P
You'll need another container, similar to m_FigArray, into which to store the items that you remove from m_FigArray (but don't delete them at this juncture, obviously, you may need to 'redo' them).
Johnsyweb
Updates to your question, incidentally, should be appended to your question, not added as answers.
Johnsyweb