LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I include in my VI actions like "Undo last action/redo last action"?

I built a Vi and I want to include functions like Undo (last action) and Redo (last action).
Any suggestion wellcome.
Thank you
0 Kudos
Message 1 of 5
(3,431 Views)
Hi

If you have the Menu Bar visible when your VI runs - this Forms your Default VI run-time Menu. You will discover a built in Undo and Redo Functions under "Edit" Menu. This fuction can be added to your custom Menus or .rtm files.

However, this undo fuctionality is limited to data change only, which means it will erase the last control change. This Undo will not reverse any data propagated as a result of your last control change. Here is an example.

Say you are taking a continuously polled value of a String control and building a Path using this, and you have a Button that says "Process Path" which ends the polling and brings you out of the While Loop. In this example if you change the value of String Control and Say Undo you will be reverted to Previo
us Value. However If after changing the Value you Clicked the "Process Path" Button, you will be Out of your While Loop with the Path being built with the Last value of String Control before "ProcessPath" was clicked. Now Clicking Undo tries to Reverse the Last Control Which was "Process Path" This has no effect on Path Value. The Undo Function will not reverse the Data which has Propagated and take you backwards in the diagram. It will simply reverse the Data Changed on the last Control.

Therefore if you want a robust "Undo" and "Redo" you will have to program this functionality, Basically you will have to trap values of all controls and on data change remember these values. On Undo you can then Change the values of Controls back to Previous Value and Also take your Diagram back to Where the Last action had impacted any data propagation.

All this - mind you - is for a single level undo. It will get complex to do Multiple Level Undo.

Good Luck! Dont you wish, you could Just
Undo the Computer Age?!!

Mache
Good Luck!

Mache
Message 2 of 5
(3,431 Views)
Thank you! If it is not too much trouble, would you be so kind as to post an example *.vi with two controls that perform the undo/redo function.
0 Kudos
Message 3 of 5
(3,431 Views)
Hi,

Here is a Sample Vi. The Nested While Loop Is the Basic Undo Redo function. This can be in a subvi too.

Also the Uno Button works as redo too!!

Hope this Helps!!
Good Luck!

Mache
0 Kudos
Message 4 of 5
(3,431 Views)
My deepest gratitude!
I thinkl this is the most complete and clear answer I have ever got in the Discussion Forum!
I would like to rate it with 5 stars or even more...
Thank you!
0 Kudos
Message 5 of 5
(3,431 Views)