12-04-2012 08:57 AM
Hi
I want to use Num Ctrl and set the Num Ctrl to increase (or decrease) 10 started from 0, each time I click up (or down) arrow .
In the attached Num Ctrl, I set Increment to 10 and Coerce to nearest in the Data Entry. But when I click up arrow, the number will increase from 2 to 12. When I click down arrow, the number will decrease from 2 to -8. I want the number increases to 10 from 0 when I click up arrow, or -10 when I click down arrow. I tried Coerce up or Coerce down, the result is the same. It is always from 2.
Any help will be appreciated. I am using Labview 2012 with f1 patch installed.
Steve
Solved! Go to Solution.
12-04-2012 09:03 AM
Steve,
this is expected behavior.
You tell LabVIEW to increment by 10 from the minimum the control can hold. The minimum is set to -32768 by default (I16). Since this is no integer multiple from 10 (leaving .8, which is no integer), you will result in a "quotient&remainder" function. The '2' is the remainder which offsets your values.
When you change the minimum (and maximum i recommend) to limit and coerce to a multiple of 10, it will work as you desire.
hope this helps,
Norbert
12-04-2012 09:09 AM
Steve,
The Increment only sets the size of the change; it does not constrain the values of the control itself.
Look at the sneaky way I modified your VI to use a partially hidden control with increment = 1 and an indicator in front of the display portion of the control showing 10*control.
Lynn
12-04-2012 09:14 AM
Norbert,
You suggestion still fails if someone types a value not evenly divisible by 10 into the control and then increments.
Lynn
12-04-2012 09:16 AM
Lynn,
you did not configure max/min and increment to coerce 😄
Norbert
12-04-2012 09:19 AM
Norbert,
I did not. Thank you.
Lynn
12-04-2012 09:23 AM
Is this a place where the properties dialog box/editor could use an upgrade? In most cases when changing the limits, it seems that coerce should be the default. Why would you set a limit and then allow the program to ignore it?
Lynn
12-04-2012 09:32 AM
Thank you very much. You have solved my problem.
Steve