Jump to content

Creating typedefs and constants - which manual should I read?


Recommended Posts

I've read :book: of the manuals that came with the LabVIEW 7.1 Developers Suite (what, no "yawn" smiley?). I'd like to define constants across all my modules, like the old-fashioned "#include" feature in a C pre-processor.

I've seen examples of what I want ".ctl" files - but somewhere along the line I've missed the chapter, section, etc. that explains all this. Could somebody please tell me where it is?

Thanks!

Link to comment
I've read :book: of the manuals that came with the LabVIEW 7.1 Developers Suite (what, no "yawn" smiley?). I'd like to define constants across all my modules, like the old-fashioned "#include" feature in a C pre-processor.

I've seen examples of what I want ".ctl" files - but somewhere along the line I've missed the chapter, section, etc. that explains all this. Could somebody please tell me where it is?

Thanks!

What you want is a .ctl file which is set up to be a typedef. A typedef, unlike a standard control, will also hold on to the values you give it, so when you update the typedef, the values will be updated whereever it's called. Just search the help or the user manual for "typedef".

Link to comment
  • 1 month later...

A followup question ...

I have a subVI returning a typedef value (a ring of listed unsigned shorts), and I would like to feed that result into a case statement. However, instead of giving me options for each possible value of the typedef, I get the standard list of ("0, default", "1"). How do I specify the type of the case selector? The "?" is wired directly to the output of the subVI ...

:question:

Andrew

Link to comment
I've seen examples of what I want ".ctl" files - but somewhere along the line I've missed the chapter, section, etc. that explains all this. Could somebody please tell me where it is?

Go to the on-line labview help and enter "customize" and select "controls".

More info is here as well.

A followup question ...

I have a subVI returning a typedef value (a ring of listed unsigned shorts), and I would like to feed that result into a case statement. However, instead of giving me options for each possible value of the typedef, I get the standard list of ("0, default", "1"). How do I specify the type of the case selector? The "?" is wired directly to the output of the subVI ...

You cannot do what you want with a ring value. You can do it with an ENUM.

You could open the TypDef'd .CTL and right-click the ring control/indicator and select Replace --> ENUM followed by an "apply changes" (in the file menu) and it would then do what you want -- assuming it did not mess up other areas of the program that used the typdef.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.