Jump to content

Programmatically Change the Default Value of a Dropdown (LV 5.0)


Recommended Posts

Due to the nature of my work, i cannot post much more than what I will, but I am having trouble selecting what data should be charted. I want to take the first 4 channels that I select in the mutiple selection list of "LiveDAS" and plot them in individual channels using "MultiChart". I believe my trouble is wanting to set the default value of the dropdown boxes in MultiChart. I am able to do almost exactly what I want if I change the drop-down boxes to "indicators". But them being dropdown boxes is rather useless if I can't "drop them down" and select another channel to plot individually if I desire. If I set them as controls, I am able to drop them down, but they will not default to the first 4 channels that I selected in "LiveDAS". I was told to try using an "invoke node". I had to look up the term as I just started programming in LabVIEW this summer. I read that it deals with ActiveX, but, as you may see from the screenshots, I am using a Sun machine, so ActiveX doesn't really apply. Thanks in advance.

LiveDAS:

livedasvk4.png

MultiChart:

multichartae3.png

Link to comment

If multichart is a subVI, the easiest solution is probably to set those rings to be in the connector pane and then you can feed a value into them when you call the subVI.

Invoke and property (or attribute, in your case) nodes are used with object oriented systems (including ActiveX controls), but I don't think it will help you much in this case, because I'm pretty sure LV 5 did not allow accessing the attributes of controls in other VIs. You can do this inside the subVI (for instance, by wiring the selection array into the subVI), but you need an attribute node with the Value property, not an invoke node. Another option is creating a local variable for the control and wiring the value into that.

Your other option would be to use some other means of transferring the selected values into the subVI, like a global variable or a functional global.

Link to comment

QUOTE(Neville D @ Jul 18 2007, 08:33 PM)

I'm pretty sure that you can't use property nodes (or attribute nodes as they were called in LabVIEW 5) because I seem to recall that the Value property came with property nodes in LV6...

Unless I'm missing something, the question is actually how to set the value of the 4 ring controls in the sub-vi based on the first 4 selected values of the list control in the parent. The way to do this is to have a hidden array control of integers (I think you can hide controls in LV5 by right clicking on them in the block diagram) that is connected to the connector pane of the MultiPlot sub-vi. Have the ring control in LiveDAS wired to this array input on Multiplot, then in Multiplot before you start doing anything else index elements 0-3 of the hidden array and feed those numbers into local vairable nodes (structures palette) for the 4 ring controls. Local variable nodes let you read/write to control or indicators irrespective of whether they are controls or indicators. They're very useful for exactly this sort of problem of sorting out initial values in a user interface, but are also very easy to abuse. Be very very careful when writing to a local variable and reading back from the control that you make sure that order of the write and read is deterinistic - i.e. controlled by data flow, otherwise you get all sorts of horrible race conditions. These typically come and bite you when you change something in the code or hardware that marginally changes the execution timings.

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.