Discussion:
get or set control value on clone
(too old to reply)
mesmith-nm
2008-08-13 15:10:07 UTC
Permalink
I cannot get or set a control value on a clone VI (created by opening a ref to a re-entrant VI with the x08 flag and invoking the the Run method and opening the front panel).  I can open a ref to the clone vi by using it's clone name (parent.vi:1, for example) and get some properties back (like whether or not it's a clone VI with the "Is Clone VI" property) but the Control Value:Get methods (both variant and flattened string) return nothing - no error, just no data.  Is this expected behavior?  The LV Help for the Control Value:Get doesn't say anything about it not working on clones. I can start my reentrant VI with the run button (not as a clone) and I can read and write to the controls just fine.  Thanks, Mark  BTW - this is LV 8.5.1Message Edited by mesmith-nm on 08-13-2008 09:42 AM
MikeS81
2008-08-13 19:10:06 UTC
Permalink
Hi Mark,i think it is because of the selected option. The helps says you can´t edit this instance. Why do you need it? Could using vi template a solution for you? Hope it helps.Mike 
mesmith-nm
2008-08-13 19:40:06 UTC
Permalink
Mike, Thanks for the response, but I don't think this is the issue - I'm not trying to edit the VI (you are correct - a clone cannot be edited), I'm just trying to get the data displayed in a front panel control by opening a VI reference and using the Control Value:Get method thru an Invoke node.  I don't know if using a VI template would work here or not - my situation is one where the reentrant VI should work great.  I launch as many copies of a monitor display as the user desires to monitor different data streams.  Also, I have a work-around using the reentrant model that's meeting my needs.  What I really hope is that someone in the know (hint-hint - LabVIEW R&D?) will chime in and tell us whether or not I'm doing something illegal or whether the Control Value:Get method just isn't working as intended.  That would be great to know for future application development. Also, it doesn't matter whether I try to get the value using the VI Reference generated when I spawn the clone or whether I open a VI reference with the clone's name and the Open VI Reference function - I get the same behavior either way.  One thing that is kind of weird is that I for a while I still can use the clone's name and still open a reference when the clone VI is stopped and the front panel is closed - does it take LabVIEW a while to get the clone's name out of memory - does it wait to be garbage collected?  If I use the VI ref captured when the clone is spawned it behaves as expected and as soon as I close the clone the ref goes invalid.  BTW, the Run method used to spawn the clone has Auto Dispose Ref set to TRUE. Mark  Mark 
MikeS81
2008-08-14 07:10:06 UTC
Permalink
Hi Mark,can you show us your vi. Your are right, it´s not the option. I made an example in 8.5 like i understand what you want and it works for me. Hope it helps.Mike


main.vi:
http://forums.ni.com/ni/attachments/ni/170/349208/1/main.vi


sub.vi:
http://forums.ni.com/ni/attachments/ni/170/349208/2/sub.vi
mesmith-nm
2008-08-14 13:40:20 UTC
Permalink
Mike, You have interpreted my question correctly and you are correct - your example works exactly as I would have expected.  And this morning, when I re-booted my computer and checked my VI with the issue, it worked as expected.  So I have no idea what was going on.  All I know is yesterday, I got nothing - no error but no data and now after nothing more than a shutdown and reboot, it works.  Go figure. Thanks for your effort to create the example and confirm that this approach should work - it's useful information. Mark 
Loading...