It appears that numerics are not sent the EVENT_VAL_CHANGED message when the user changes the text in the box. I created a simple uir with a numeric, led, and exit button with the below code:
#include
#include
#include "numeric.h"
static int panelHandle;
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "numeric.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK OnNumeric (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
SetCtrlVal(panel, PANEL_LED, 1) ;
switch (event)
{
case EVENT_VAL_CHANGED:
SetCtrlVal(panel, PANEL_LED, 1) ;
break;
case EVENT_COMMIT:
SetCtrlVal(panel, PANEL_LED, 0) ;
break;
}
return 0;
}
int CVICALLBACK onbutton (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}
The light never turns on when I am changing the value of the numeric by typing numbers in it. It does turn on when I change the value using the incr/decr arrows. The control mode is set to hot.
Is this
a. Me missing something
b. suppossed to work this way
c. error
What I need to do is detect when the user has typed a new number in the numeric and update things accordingly.
As a side note the EVENT_VAL_CHANGED message is sent to text boxes and the user types text into them, I would think that the Numerics should work the same way.