09-17-2008 03:25 PM
Hi,
I could not figure an easy way or if LabVIEW already have something in this my situation.
I have a numeric control A, with default value of 4. I have a control B with defualt value of 2. The user can change the values of both controls, however, I want the value of control B at any time to be less than or equal to the twice the value A. i.e 2*Value B <= ValueA.
When the user tries to violate this relation , either he will be unable to adjust the control, or a message will appear prompting him that the relationship of the two controls must be maintained without terminating the program.
Thanks
09-17-2008 04:04 PM
09-17-2008 04:12 PM
My vote would be a case structure within an event structure.
The event trigger will be the user changing the control (A or B).
If you ratio is OK, have it follow the rest of the code in the case structure -->
If it is not, put a prompt in the false case, so it will prompt the user, but will keep running.
09-17-2008 05:05 PM
Thanks tjazx9r and Cory. Yes I think using the case structure with event will be perfect, especially since the false case will warn the user but not terminate the program.
09-17-2008 05:13 PM
Using a event structure is a good idea. In addition you can control B using property nodes.
Just an idea!
09-17-2008 05:13 PM - edited 09-17-2008 05:16 PM
You can achieve your objective with a simple event structure, and no case :
Set the response of B to values outside limits to coerce. Then, when the value of A is changed, adjust the maximum value of B.
Accordingly, if you decrease A, B will be automatically decreased to respect the condition. And increasing A will makes more room for B to grow.
(BTW, there is a contradiction in the way your question is formulated : the text and the equation are opposed). See the diagram below
09-17-2008 05:59 PM
Thanks a million GovBob and Chilly Charly.
Chilly, you were right, my equation and description were not consistent, in any case I got the idea. Most importantly, there is no need for a case structure to inform the user of the relationship, the software will force the relationship. LabVIEW is FANTASTIC