Code snippets don't always work
#1
Posted 25 February 2010 - 05:36 PM
http://zone.ni.com/d...a/tut/p/id/9330
But when I try and drag and drop this snippet:
http://decibel.ni.co...t/docs/DOC-9812
I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.
#2
Posted 25 February 2010 - 05:44 PM
Snippets only work ofr the most trivial examples. Virtually every Snippet that uses a property nodes is bad because it repalce the explicitly linkedproperty node with a ref and a property node where the ref is not for the original control.I suspect there is a simple answer to this, but I'll be darned if I can figure it out. Why don't code snippets always work? For example, I can drag and drop every snippet on this page just fine:
http://zone.ni.com/d...a/tut/p/id/9330
But when I try and drag and drop this snippet:
http://decibel.ni.co...t/docs/DOC-9812
I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.
If you want to make it work, pop-up on the control and select create ref and use THAT ref instead of the one used in the Snippet.
Confirmed bug by the way,
Ben
#3
Posted 25 February 2010 - 06:19 PM
Property nodes may be part of it, but I found some other examples that also don't work. This one uses a strict type def which may be causing the problem:
http://decibel.ni.co.../state-machines
This one, even the 2-D array constants (which worked in the link in the orginal post) don't work:
http://decibel.ni.co...t/docs/DOC-6108
#4
Posted 25 February 2010 - 06:27 PM
Thanks for the reply, Ben
Property nodes may be part of it, but I found some other examples that also don't work. This one uses a strict type def which may be causing the problem:
http://decibel.ni.co.../state-machines
This one, even the 2-D array constants (which worked in the link in the orginal post) don't work:
http://decibel.ni.co...t/docs/DOC-6108
Just look at Snippets as if they where a "Public BETA" for the time being. THe good news is that "Create Sub-VI" did not get damaged along the way.
Ben
#5
Posted 25 February 2010 - 07:32 PM
The issue in this case is not with VI snippets, but how they are attached and/or displayed in forums or web pages. Often the image is just a placholder for the real image file. The placeholder image doesn't contain any of the VI code for the snippet feature to work. When you drag it, you get the circle with line through it (operation not allowed).
When you find these cases, right click on the image and select "Save Target as..." (not "Save Picture as...") to save it to you computer. Then drag the resulting image file to your LabVIEW VI and the snippet should work fine.
I was able to get all the snippets you referenced into LabVIEW, though some searched for missing VIs or typedefs that aren't saved in the snippet.
-Scott
#6
Posted 25 February 2010 - 07:57 PM
Your second image doesn't look very 'sharp' an indication the image is rescaled. A good image editor would remove the VI snippet during the scaling. (here's why)I suspect there is a simple answer to this, but I'll be darned if I can figure it out. Why don't code snippets always work? For example, I can drag and drop every snippet on this page just fine:
http://zone.ni.com/d...a/tut/p/id/9330
But when I try and drag and drop this snippet:
http://decibel.ni.co...t/docs/DOC-9812
I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.
Ton
#7
Posted 25 February 2010 - 08:07 PM
Eric, Ben,
The issue in this case is not with VI snippets, but how they are attached and/or displayed in forums or web pages. Often the image is just a placholder for the real image file. The placeholder image doesn't contain any of the VI code for the snippet feature to work. When you drag it, you get the circle with line through it (operation not allowed).
When you find these cases, right click on the image and select "Save Target as..." (not "Save Picture as...") to save it to you computer. Then drag the resulting image file to your LabVIEW VI and the snippet should work fine.
I was able to get all the snippets you referenced into LabVIEW, though some searched for missing VIs or typedefs that aren't saved in the snippet.
-Scott
Confession time!
I only looked at the links from the original post and the second one takes you to "Groovy Thermometer" which simply can not work.
Ben












