MFC Redo Function
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?
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.
精彩评论