Stephen wrote
>Create a new subVI. Put a constant on the block diagram, connect it to an
>indicator. Connect the indicator to the conpane of the subVI. Then where
>ever you want the constant, drop the subVI.


And Aaron suggested something identical.


Hmm. So when comparing performance with C, we have on the one case an
elegant and simple way to control the value of a constant throughout the
scope of a #define, and in the other, we are advised to perform a function
call to return a simple constant value.  If I told my C programming buddies
they had to perform a function call to get a constant value returned to a
program, the laughter wouldn't die down for years.  

Let's just admit it.  LabVIEW has no exact equivalent to the #define !right
now!.  There are workarounds that might be nearly as useful; maybe the
closest equivalent would be to create a strict typedef'd custom control,
hidden on the panel, with the default value set to the value desired.  Now
if NI were to add the capability of locking the value of a control, then
we'd be closer; disabling (and perhaps greying out, instead of hiding) the
control sort of gets there, I guess.  

However, having a separate .ctl file for each define is extreme.  Maybe the
answer is a "defines.ctl", with a cluster of controls with the desired
default values, and an unbundle on the diagram to access the particular
define desired?  To me, this beats the heck out of a global, as the value is
much less accessible, and is defined "at compile time", whatever that means
in the LabVIEW context.  However, the extra unbundle is a pain; IMHO, the
ability to select a sub-component of a cluster directly on the
control/indicator terminal would be better, and would parallel the terminal
functionality of a global, but my guess is that's at least LabVIEW X.


Just my $0.02 viewpoint.

Blair Smith


Reply via email to