Thanks for the fast reply.
I’ll try that.
Here is my somewhat lengthy explanation as to why I asked the question:
My use case is Undo functionality. And I am getting problems with undo. Thats the reason for the post.
I have four instrument panels. And each instrument panels has sliders. If you click on an instrument panel, you activate the instrument. So thats an undoable action. Changing the value of the slider is another undoable action.
Now imagine you decide to drag a slider, without the instrument being activated.
Then this happens: First slider MouseDown is called and the slider changes its value, which of course also goes into the UndoManager. Next thing that happens: the MouseDown event is upcasted to the parent panel. That activates the instrument panel, which, again is sent to the UndoManager. But the user is still dragging the slider. Which means, that further slider value updates are made, which again go to the UndoManager.
So what is the problem here? The “activate instrument” action is coming during the slider drag. In other words: first the slider is dragged a very small amount, then the instrument is activated and then the slider is dragged some more.
Now if you press undo, this happens: First most of the slider movement is undone. Second time you press undo, the “activate instrument panel” is undone.
And now the problem comes: If you press undo a third time, it will once again change the slider a little bit. That is the little bit the slider was able to move, before the initial call to “activate panel” was made.
So this is three undos, all in all.
But I just want two undos. Because that is a nicer user experience:
One undo which changes all of the slider value. And another undo, which changes the instrument panel activation. This can be acomplished by making sure, that the “activate instrument” is called, before changing any slider value.
Hope my explaning makes sense?