postformac Posted May 10, 2009 Report Share Posted May 10, 2009 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 Quote Link to comment
postformac Posted May 10, 2009 Author Report Share Posted May 10, 2009 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? Quote Link to comment
ShaunR Posted May 10, 2009 Report Share Posted May 10, 2009 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. Quote Link to comment
LAVA 1.0 Content Posted May 10, 2009 Report Share Posted May 10, 2009 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 Quote Link to comment
postformac Posted May 10, 2009 Author Report Share Posted May 10, 2009 Ok cheers, got it all working. I set the limits in a separate VI and then left the property nodes in the main VI as you suggest, all that would have been in the sub-VI was the decision for the limits and the property bit so I agree it is clearer to do it this way. Thanks Quote Link to comment
ShaunR Posted May 10, 2009 Report Share Posted May 10, 2009 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). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.