Hello,
I’m trying to add undo/redo functionality to some mouse drag events. The problem I’m having is the undo action for the drag event seems to be disappearing from the undo stack. So, for example if I do the following:
- Make some edit in the application
- Do a mouse drag
- Hit Undo key command
What happens is the undo manager undoes the edit from step 1. Stepping through the code i can see the undo for the transaction in step 2 is never called. Here is what is happening in the code:
void mouseDown(const MouseEvent& e)
{
undomanager->beginNewTransaction();
}
void mouseDrag(const MouseEvent& e)
{
myDataModel->updateFoo();
}
void MyDataModel::updateFoo()
{
myUndoableAction *ua = new myUndoableAction();
undoManager->perform(ua);
}
I’ve also tried structuring it the way described in this forum post:
http://rawmaterialsoftware.com/juceforum/viewtopic.php?t=948&highlight=undo
but I still have the same problem. Does anyone have any advice or tips on how to get this working? Thanks in advance.[/url][/code]