LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Num Ctrl, Increment 10 Coerce to nearest

Solved!
Go to solution

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 

0 Kudos
Message 1 of 8
(2,880 Views)
Solution
Accepted by topic author Shijie

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(2,873 Views)

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

0 Kudos
Message 3 of 8
(2,869 Views)

Norbert,

 

You suggestion still fails if someone types a value not evenly divisible by 10 into the control and then increments.

 

Lynn

0 Kudos
Message 4 of 8
(2,867 Views)

Lynn,

 

you did not configure max/min and increment to coerce 😄

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 8
(2,865 Views)

Norbert,

 

I did not.  Thank you.

 

Lynn

0 Kudos
Message 6 of 8
(2,863 Views)

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

0 Kudos
Message 7 of 8
(2,856 Views)

Thank you very much. You have solved my problem.

 

Steve

0 Kudos
Message 8 of 8
(2,839 Views)