Jump to content

Programmatically changing the value of a "numeric control"?


Recommended Posts

Hello,

I have a front panel with a Numeric Control and a group of radio buttons.

When a radio button is selected, I would like the value of this numeric control to be forced to a button-specific preset value.

How can this be done (in LV 8.0)?

I presume that it may be somewhat similar to initializing the captions of the radio-buttons to preset values, e.g., values read-in from an external file. I found an example of how to do this, see attached (though I am not sure how it works exactly :(). Of course, that initialization is only done once, not upon an event such as radio-button selection....

Thanks in advance for any help!

post-18375-0-82172100-1344428261_thumb.j

Link to comment

Hi Shaun, I'd love to try it, but silly me, the Numeric Controls that I can conjure up in LV8.0 don't seem to have an input, and under "properties" (advanced or other), I don't see an intuitively obvious way (to me) that wil let me add such an input. :(

post-18375-0-79677800-1344448440.jpg

Link to comment

Got it - works like a charm, exactly what I needed/wanted!

Did have to change the property node from "value" to "value (Signaling)" for the icon to have an input rather than an output...

You guys are great, thanks for the help! :worshippy: :worshippy: :worshippy:

Link to comment

You can change the Value from a read to a right by right clicking on the property and choosing to "Change All to Write" or "Change To Write" from the pop-up menu.

However, if your literaly just setting the value, right clicking the terminal and creating a local variable instead of the value property will create a faster setup (local variables are much faster than "Value" property nodes)

Link to comment

OK, got to bug you guys one more time (well, at least on this particular subject :D)

The "set value upon radio-button change" works, but the radio-button has to be in the while-loop. This means that the preset value associated with the selected radio-button gets (re)loaded into the Numeric Control each iteration of the while-loop. This effectively overrides/overwrites any value that the user inputs directly into the Numeric Control box, or increment(decrement via the up/down buttons of the Numeric Control.

Me thinks that I need to put the radio-button selector and associated value selection into an Event Structure (a new adventure for me), that only executes once upon selection of a (new) radio button. My feeble and ineffective attempt to do this is in the attached jpg. Help, please !?

post-18375-0-35275300-1344612000_thumb.j

Link to comment

Use the event structure with a case for the Value Change event of your "VFO - Band Selection". Move the property node for "Dialo frequency input" into that same case to keep all the logic contained (even if you have multiple cases setting the value, just use individual property nodes - little more BD space, but cleaner and easier to read). Also, you may not need to use a signalling value ("Val(Sgnl)") property node for the "Dial frequency input" unless you have other code in the event structure that reacts to value changes on that control.

Link to comment

Try to run your code in execution high-lighting mode.

This will show that your loop will wait on the event of the menu button.

You can change this by adding a timeout of 100 ms (making your loop run every 100 ms.)

However I advise you to look at some training. NI has 3 and 6 hours online courses (I believe they are free), or read a book.

LabVIEW for everyone is a good start.

Ton

Link to comment

Bedankt Ton!

That did the trick!

As to the training: sounds like a good idea. Not that I intend to do this for aliving :) (yet :D), but it would be a more systematic approach to becoming knowledgeable. There are soooo many properties, parameters, options...Of course, that makes it a powerful tool as well.

Thanks again for all the help everyone.

Frank

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
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.