LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Determination of Integer values

Hi,
I tried to build a short program to determine whether there is an integer value in a floating point numeric control.
It is working fine as long as I am using the keyboard to change the values confirming with enter.
But if I use the increment and decrement buttons to change a value only the number I entered with the keyboard is detected to be an integer.
 
E.g. I write a 2 into it and press enter -> integer
       
0 Kudos
Message 1 of 2
(3,063 Views)

I wrote a quick test case with the callback below and it successfully detected integers and non-integers, even if I changed the value with the increment/decrement buttons.  Hope this helps.

int CVICALLBACK numericChange (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:
   
   GetCtrlVal(panel, PANEL_NUMERIC, &controlValue);  // note - controlValue is a double   
   if ( fmod(controlValue,1.00) != 0) SetCtrlVal(panel, PANEL_LED, 0);
   else SetCtrlVal(panel, PANEL_LED, 1);

   break;
 }
 return 0;
}

Best regards,

Kevin C.

0 Kudos
Message 2 of 2
(3,055 Views)