03-07-2013 10:47 AM - edited 03-07-2013 11:02 AM
Hi everybody,
I'm facing a small problem dealing with VI references and subpanels.
I made a 'Main VI' which contains 4 subpanels and a tree view. The idea is to to drag and drop 'items' from the treeview into any of the 4 subpanels. Each item correspond to a specific VI. This works perfectly fine.
The idea is also to keep the VIs loaded running until the 'Main VI' is executing. This allows to launch as many executions as needed ; when an item is droped in a subpanel if it's already running (droped before in any subpanel) it shows the current execution FP state. This work perfectly fine, each VI 'loadable' in a subpanel is reentrant and launched using VI Server w/option 0x08 and I keep track of each execution using a pool of opened VI references.
The problem occurs when trying to drop an 'item' which is already displayed in a subpanel. Error 1145 is thrown. In that case I would like to make the subpanel currently holding the already existing execution blinking.
So I had the idea to use 'Inserted VI' property on each of my subpanels (so 4 references) to detect which one is loaded with my VI. To do that I compare the reference coming from 'Inserted VI' property f each of my subpanels to the currently opened VI ref (see pics attached). But it appears that both references are different !! How is that possible ?
How to find the real reference of the VI loaded in the subpanel ?
03-07-2013 11:06 AM
Try doing the comparison without the Type Cast. Equals? will return true if two references with different numeric values both reference the same object.
03-07-2013 11:36 AM
03-07-2013 11:39 AM
Ah, should have read that part. Sometimes I am a picture person and skip text.
03-07-2013 12:46 PM
My suggestion would be to track it yourself - just log which SP holds which VI and search that log to know.
03-07-2013 12:48 PM
Yes at the end it be like that, I'll have to handle it like this...
But it doesn't answer the question : why is the 'inserted VI' ref is different from the original reference ?
03-08-2013 09:29 AM
Hello,
I don't think it's such a strange behaviour. In fact, if you had the same refnum, it means that you are pointing to the same VI. As you have two instancies loaded, they must have a different refnum.
Regards,
Mathieu P. | Certified LabVIEW Associate Developer
National Instruments France
03-08-2013 11:10 AM
My solution to this is to use VI Clone Name as the lookup key rather than the reference.
03-08-2013 11:22 AM
Mathieu, this is the purpose of my problem : I want to point on the same VI ! I load a VI in a subpanel and I want to retrieve its reference using the property node 'Inserted VI'. So it should give me the same reference as the ref loaded...
Or, maybe, it means that this property node gives another reference on the same VI (like if there was an 'open VI ref' function hidden behinf this property node). THIS would be weired !
03-08-2013 11:25 AM
Hi Jack,
How do you get this VI clone name ?
Is this name unique to a VI reference even if this VI is set as reentrant and launched using 'open VI ref' with option 0x08 ?
Just to let you know, I found a way to the job by my self using an array of cluster to store all needed information.
But I really would be interested in knowing how this 'Inserted VI' (new in LV2012) property node works !