Jump to content

Simple way to clear a VI Undo History?


Recommended Posts

I want to clear a VI's undo history, programmatically, from another VI. I see in 2013 that saving doesn't clear the history, so my original plan to simply save my target VI somewhere isn't working. Is there a scripting technique that will obliterate the undo history?? A quick search didn't find anything.

Edited by Thoric
Link to post
Share on other sites

Thanks Darin. I'll try that. Presumably if I take my target VI, apply a password, remove the password, I'll find the undo history is blank and the VI remains unprotected. Cheers! :worshippy:

 

Edit: it seems LAVA now thinks I'm no longer "Thoric" but "Riggy" !?

Edited by Riggy
Link to post
Share on other sites
Changing the password erases the undo history.

 

I can't get this to work programmatically.

 

If I manually set a VI's protection to password-protected through the VI Properties window, then unprotect it again, I see the Undo history is emptied.

 

However, if I programmatically invoke LockState.Set with Password-protected, then invoke LockState.Set with Not Locked, the VI undo history remains in tact.

Inserting a Save.Instrument makes no difference either. The Undo history always persists! Any thoughts anyone?

 

Below is a snippet of some example code that attempts to prove that password protection of a VI clears the undo history. It creates a new VI, uses a Windows API call to simulate a standard window move operation as normally performed by an operator, then sets and unsets a password to clear the undo operation but it remains intact.

 

(I will get the snippet up here once I figure out how!)

Link to post
Share on other sites
If you drop a dummy object on the diagram, then delete it, without wrapping those operations in a Begin Undo/End Undo transaction, it looks like it clears the Undo history.

 

How bizarre! Yes, that works. Dropping a simple ADD function, then deleting it, vaporizes the Undo History. Any thoughts as to why? Can LV not cope with changes that aren't wrapped in an Undo transaction?

post-33316-0-34725100-1395936366_thumb.p

  • Like 1
Link to post
Share on other sites
  • 6 months later...
  • 2 years later...

I'm looking for a way to change a visible state of a Case Structure, and (A) not have this show up in the Undo Transaction history and (B) not wipe out the undo history. Right now, if I don't create an undo transaction for the visible frame change, it wipes out the undo history :-(

Link to post
Share on other sites
1 minute ago, Jim Kring said:

I'm looking for a way to change a visible state of a Case Structure, and (A) not have this show up in the Undo Transaction history and (B) not wipe out the undo history. Right now, if I don't create an undo transaction for the visible frame change, it wipes out the undo history :-(

I don't know of a way to accomplish this. As discussed above, changing a VI with scripting requires the Transaction methods to preserve Undo history. To my knowledge you can't modify a VI with scripting, have that modification not show up in the Undo history, but preserve the previous Undo history.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.