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?
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.
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?
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.
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...
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.
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