Jump to content

Problem with Limits on DBL Slider


Recommended Posts

Hello!

I think my problem concerns something that many people should be using. I already contacted NI because of this problem but they could not find a solution so I hope someone here may know an elegant way to solve it.

I have a slider control with digital display configured with the following settings:

Scale Range Min: -60 (just for example)

Scale Range Max: 60 (just for example)

Data Entry Min: -45 with "Coerce"

Data Entry Max: 45 with "Coerce"

Increment: 0.1 with "Coerce to Nearest"

My problem is that when I start incrementing the values using the increment/decrement button (or up/down arrow keys) often I can only go up to 44.9 but not to the full maximum of 45. The same happens when I decrement towards the minimum, there I get to -44.9 but not to the full minimum of -45. If I set the value directly to 45 or -45 through the slider or by entering 45 or -45 into the digital display everything is fine and I reach the full limits.

The problem seems to be that double values cannot be represented exactly on computers and if a value is incremented/decremented it goes a bit over/under my limit (even if this becomes visible many digits behind the decimal point) and LabVIEW won't set the slider to the limit so it stays at the previous value (44.9 or -44.9).

Whether I can reach the full minimum or full maximum seems to depend on my starting point on the slider, i.e. from where I start to increment or decrement.

I tried many things like adding tolerances of 0.001 to the Data Entry Min/Max to make this work but it did not help or introduced other problems. I even set the Data Entry Min and Max to "Ignore" instead of "Coerce" but when I increment/decrement again I don't get the full range. This is very strange because I can enter values like 50, 60 and so on and they are accepted, I just don't get from 44.9 to 45 by incrementing.

My question is: Is there any solution other than setting Data Entry Min/Max and Increment to Ignore, rounding my values manually and setting the slider manually to the desired value after its Value Change Event? This will cause additional overhead and is not what I expected from an expensive program like LabVIEW.

Thanks for any help in advance!

Anguel

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.