property nodes vs reference

This is a discussion on property nodes vs reference within the labview forums in Programming Languages category; Gurus, Attached is a simple program that does nothing but illustrate my questions. What is the difference between changing/updating information/variables etc by reference and by property node? And which should be used under what circumstances? I have some controls/indicators that will be updated from several locations, sometimes disabled/enable and sometimes blink, so I am using a variety of properties for a single element. Having looked at the help pages, I am confident I understand the difference between property nodes and local variables. P  property node vs reference.vi: http://forums.ni.com/ni/attachments/...239/1/property node vs reference.vi...

Go Back   Application Development Forum > Programming Languages > labview

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-14-2008, 05:40 AM
Manc Pablo
Guest
 
Default property nodes vs reference

Gurus, Attached is a simple program that does nothing but illustrate my questions. What is the difference between changing/updating information/variables etc by reference and by property node? And which should be used under what circumstances? I have some controls/indicators that will be updated from several locations, sometimes disabled/enable and sometimes blink, so I am using a variety of properties for a single element. Having looked at the help pages, I am confident I understand the difference between property nodes and local variables. P 


property node vs reference.vi:
http://forums.ni.com/ni/attachments/...239/1/property node vs reference.vi
Reply With Quote
  #2  
Old 08-14-2008, 07:40 AM
cschneider
Guest
 
Default Re: property nodes vs reference

Hi, the behaviour of a reference is difference from the behaviour of a property node. You can use property nodes to change attributes of a control, like blinking, color etc. You have to use a reference to a control if you want to access these properties from another vi. You can pass a reference by a connector pane to another vi, wire it there to a property node and access the properties of a control which is not part of the active vi.  Hope this helps, Christian
Reply With Quote
  #3  
Old 08-14-2008, 08:10 AM
Manc Pablo
Guest
 
Default Re: property nodes vs reference

Yeah, it does. So a reference it is a bit like a global variable but with the bonus of changing more than just the value? Does the reference option have any similarity to pointers in other languages? P 
Reply With Quote
  #4  
Old 08-14-2008, 09:10 AM
muks
Guest
 
Default Re: property nodes vs reference

 
the behaviour of a reference is difference from
the behaviour of a property node. You can use property nodes to change
attributes of a control, like blinking, color etc. You have to use a
reference to a control if you want to access these properties from
another vi. You can pass a reference by a connector pane to another vi,
wire it there to a property node and access the properties of a control
which is not part of the active vi.
  Nice and crisp explanation. 
Reply With Quote
  #5  
Old 08-14-2008, 09:10 AM
Ben
Guest
 
Default Re: property nodes vs reference

Manc Pablo wrote:
Yeah, it does. So a reference it is a bit like a global variable but with the bonus of changing more than just the value? Does the reference option have any similarity to pointers in other languages? P 
Yes, but don't get caried away! Refernces to controls are like file references where they are a number that lets the environment located a resource. But as you may have seen if you share a ref to a file across multiple threads, there are possiblities of race conditions if the access to the resource is not protected in some way. LV protects the resource by using the UI thread (single threadded) to help but if you don't pay attention to reace-conditions you will run into trouble. But now to the critiacl point. Many converts to LV get the idea that locals (or control references) in LV are like locals in C and use them in a manner similar to what is typically done in text languages as named variables. Named variables in C are just an easy way to keep track of a block on memory. In LV you do not have to keep track of the memory since LV does this for you. It does this for every wire you put on a diagram. In LV the wires are your buffers, memory locations etc. Or as I believe Christian has written, "The wire is the data." If you would like to keep working with your current schema you can put free lables over your wires while you are making the paradigm shift to the dataflow. Controls and indicatrs should not be used for storing or sharing data except in the most simplistic cases. Use your wires to move data from operation to operation. If the data is to be shared, use Functional Globals (also called Action Engines) Queues, etc. I hope I am not sounding preachy with this post. I just want to make sure you don't make the mistake I did when I converted from C to G.  Ben
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:22 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.