LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Precision

Hi

 

Is it possible to make a double numeric control have Dynamic Precision?

eg. if the value is 1.0  the control would be 1

     but if the value is 1.1 the control would be 1.1.

Help share your knowlegde
0 Kudos
Message 1 of 5
(3,258 Views)

Hi Shako,

 

The problem will be that most numeric values will not be as simple as that, e.g. instead of 1.1 you might have 1.099999999999999. How will you decide that this number should display with one digit instead of with 15?

 

Wolfgang

0 Kudos
Message 2 of 5
(3,257 Views)

Well you would still have a maximum precision which would justify wether to round it or not.

 

What im really looking for is a double control which would truncate all trailing Zeros?

Help share your knowlegde
0 Kudos
Message 3 of 5
(3,254 Views)

concerning the numeric precision, see here

 

concerning the dynamic precision, in your callback routine you can multiply the new value by 10 (iteratively in a loop) and see if the remainder is zero. Is so you can adjust the numeric precision of your control using SetCtrlAttribute ( ,,ATTR_PRECISION);

0 Kudos
Message 4 of 5
(3,252 Views)

Im doing this for some controls.

 

Is there a way i can make a custom control to do this?

Help share your knowlegde
0 Kudos
Message 5 of 5
(3,243 Views)