Jump to content

Data entry according to input


Recommended Posts

Hi,

Is it possible to set the data entry limits for a control according to the value of another control?

For example, I have a program that generates a number of sine waves and plots them on a graph. A number of attributes for the waveforms can be altered and one of those is relative phase. The user can enter the phase offset in degrees or radians and selects which is to be used via a drop box. I want to restrict the max phase offset to 90 degrees so I have set the data entry limits to between 0 and 90 deg. However, if the user has selected to enter the phase in radians this now means they can enter up to 90 radians.

I want the limits on the control to be 0-90 when degrees is selected but only 0-1.5708 when radians is selected (= 90 degrees). Is that possible?

Thanks

Link to comment

Thanks for the reply, I have never seen that before, is that a "register for events" box? I'm not sure what I would need to do with it to have it affect a control, do I need to somehow connect it to the two controls?

Oh ok, its a property node, I found it and got it to work thanks.

Is it possible to put that function inside a sub-VI and still have it affect the controls on the front panel of my main VI?

Link to comment

QUOTE (postformac @ May 9 2009, 01:24 PM)

Thanks for the reply, I have never seen that before, is that a "register for events" box? I'm not sure what I would need to do with it to have it affect a control, do I need to somehow connect it to the two controls?

Oh ok, its a property node, I found it and got it to work thanks.

Is it possible to put that function inside a sub-VI and still have it affect the controls on the front panel of my main VI?

It is if you pass the refnum to the sub vi. If you just select the property node and select "Create Subvi" from the Edit menu you will see what I mean.

I don't consider it as good coding practice since it hides what you are doing. I would prefer to see a vi that returns the new values to the property node in the same vi as the control appears.

Link to comment

QUOTE (ShaunR @ May 9 2009, 02:40 PM)

I don't consider it as good coding practice since it hides what you are doing. I would prefer to see a vi that returns the new values to the property node in the same vi as the control appears.

Why should this be a bad thing?

If you create a good reusable VI for such a specific action I have no reason why this is a bad technique.

If it only is a bad thing if the only thing contained inside the subVI is a property method.

Ton

Link to comment

QUOTE (Ton @ May 9 2009, 03:06 PM)

Why should this be a bad thing?

If you create a good reusable VI for such a specific action I have no reason why this is a bad technique.

If it only is a bad thing if the only thing contained inside the subVI is a property method.

Ton

Personal preference.

For me. I like to see controls/indicators and their associated property nodes at the same level so I can see whats going on and apply probes without delving into sub-vi's. I had one bug in someone elses application that I needed to fix where on certain occasions a particular control would change its decimal places and others their colour when they shouldn't. The culprit was 5 levels down the hierarchy from the vi's affected and was a property node that changed the DP (amongst other things) dependent on a limit test supplied from another parts of the code (they didn't include the upper limit).

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.