12-02-2009 06:47 AM
The latest version of the Code Capture Tool makes wonderful snippets in LabVIEW versions as far back as 7.0, but only LV 2009 users benefit from them. With Ton's help, I wrote a VI to extract the VI information from a CCT generated PNG file, allowing me to use pre-2009 snippets in LV 8.6. The next step I'd like to take is to convert the PNG to code directly on the block diagram. So, I have two questions:
Thanks,
Jim
12-02-2009 02:36 PM
It is funny that you struck upon this method of extracting the snippets. When I originally started probing snippets I explored various ways to get them back out in earhtlylier LV versions and this is one of them that I explored. It is not bad, I slightly prefer the helper application I included on the NI rforum thread. Anyway, here is some code I threw together way back when, and like my other snippet/fragment software it is written during coffee breaks, etc. so debugging and style points were not high on my list. You can either pass a VI name or reference and it will convert all snippets on the BD to their code equivalents, some crude version control is included as well. Seems to work reasonably well, you may want to polish it up a little.
I use the size information to link the snippets to the corresponding decoration reference, potential for trouble with two different snippets with exactly the same size.
Let me know if this helps.
As to detecting the drop, I also went down that path. It takes a little work to get Windows Messaging set up, but it finally worked for me with one caveat. I could not intercept drops if LV was already handling it, for instance, a block diagram in edit mode. I could drop snippets just fine in LV8.6 and 8.2 as long as the target BD was not in Edit mode. Not preferred behavior and I didn't really dig any deeper. Fun to see, nonetheless.
12-02-2009 03:08 PM