Quick Drop Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

Undo Quick Drop

Hi All, 

it´s probably a basic question, however also one I haven´t been able to find answer for - how to implement Undo action for QD, so after using QD, I can press ctrl+z and undo my QD?

0 Kudos
Message 1 of 7
(2,099 Views)

Go look at the QuickDrop Plugin Template located at <LabVIEW>\resourece\dialog\QuickDrop.  Notice at the beginning of the code, there is a method called "Transaction.Begin Undo".  This starts a transaction for the Undo stack.  At the end is a case structure depending on if the the plugin was successful.  If it was successful, the method is "Transaction.End Undo", which will actually add the transaction to the Undo stack.  If the plugin had an error, the method is "Transaction.Fail", which I imagine just throws away the transaction and possibly backs off any changes since the transaction started.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(2,089 Views)

Yes, I thought that to be the case. However, I also think that is exactly what I am doing here, yet the result is that undo action still isnt´t enlisted into undo queue. Still, I am confident the issue comes from between my keyboard and chair 😄 . Do you please have any idea, what might be wrong?

0 Kudos
Message 3 of 7
(2,084 Views)

A couple of things I would look at:

1. What if the icon does not have any layers?  This will cause the transaction to fail.  The more I look at the code, the more I think that this is desired.

2. Are you getting an error?  Use probes to find out.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(2,067 Views)

1. Yes, that is the desired behavior. I want to delete only that hardcoded (NI_IconNumber) layer. In case that there is no such a layer, I don´t want anything to happen. From testing I have done so far, this works as desired.

2. There are no errors. Actually, everything appears to be working all right. Except undoing...

0 Kudos
Message 5 of 7
(2,064 Views)

It looks like icon edits are not added to the undo stack. You can reproduce this behavior with the IDE, no scripting required. Edit the icon of a VI interactively and click OK. You'll see the icon edit is not added to the undo stack for interactive edits either.

Message 6 of 7
(2,056 Views)

Good idea Darren, I actually haven´t thought of that. It seems that undo action is really not working with icon editing, which is pity. Thanks for help, I would waste more time with it today

0 Kudos
Message 7 of 7
(2,035 Views)