10-10-2018 12:43 PM
I'm just curious why creating a local variable for a control or an indicator gives a "write" local variable rather than a "read" local variable. Is this most people's preference?
10-10-2018 12:44 PM
I know I would prefer that the default be for a read rather than a write.
10-10-2018 12:52 PM - edited 10-10-2018 12:52 PM
I also find I'm much more likely to read from, than write to, a local. In fact, any variable, period. Especially globals, because I'm only going to ever write to one once.
10-10-2018 12:54 PM
It makes sense to me that write would be the default for a control, since you always need to use a local variable to write, but are able to read directly from the terminal. Definitely there are cases you want to read from a local variable for ease in programming, but it does still make sense that the default would be for what you NEED it for.
10-10-2018 01:02 PM
@prettypwnie wrote:
It makes sense to me that write would be the default for a control, since you always need to use a local variable to write, but are able to read directly from the terminal. Definitely there are cases you want to read from a local variable for ease in programming, but it does still make sense that the default would be for what you NEED it for.
Good point.
10-10-2018 01:21 PM - edited 10-10-2018 01:23 PM
If someone knows an INI key to change this default behavior then you'll earn a kudo. I too read more often than write. I actually remember an API someone wrote that relied on global variables which were put on the palette (instead of it being class based) the reference was just there for the public with bold test in the description saying something like "DO NOT WRITE TO THIS GLOBAL ONLY READ" And then as soon as you put it on your block diagram it defaulted to write.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-10-2018 01:26 PM
You'll get kudos from me, too. I find myself saying "dang!" way more often than "thanks!" when I drop a local or global onto the block diagram. 😉
10-10-2018 03:48 PM
I also think that "write" is a good default. It is my typical case (e.g. update controls based on an ini file). I typically read from the terminal of the control directly.
(Ideally, unwired local variables should be "undecided", with a terminal on either side. Once we wire to/from one of the sides, it would automatically turn into read or write, depending on the connection just made. Just an idea. :D)