Hi!!
I tried to execute the code below. The idea is to change the Knob style pressing one of the two command buttons (PANEL_MAIS and PANEL_MENOS) that are displayed. The callback function of both buttons is called teste.
The knob button displayed is an activex controller from cwui package (CWKnob Control from National Instruments).
The task is very simple, but I don't know why it is not working.
What is the problem?
Thank you in advance.
//interface.h
#define PANEL 1
#define PANEL_CWKNOB 2
#define PANEL_MAIS 3 /* callback function: teste */
#define PANEL_MENOS 4 /* callback function: teste */
-------------------------------------------------------------------------------------
//main.c
#include <cvirte.h>
#include "interface.h"
int g_intMainPanelHandle;
CAObjHandle ObjHandle;
int aux = 5;
ERRORINFO *Error;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
g_intMainPanelHandle = LoadPanel(0, "c:\\Documents and Settings\\gbolivei\\Desktop\\teste\\interface.uir", PANEL);
DisplayPanel(g_intMainPanelHandle);
GetObjHandleFromActiveXCtrl (PANEL, PANEL_CWKNOB, &ObjHandle);
RunUserInterface();
return 0;
}
int CVICALLBACK teste (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
switch (control)
{
case PANEL_MENOS:
aux--;
CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, aux);
// CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, CWUIControlsLibConst_cwKnobStyleVLeftGauge);
break;
case PANEL_MAIS:
aux++;
CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, aux);
break;
}
break;
}
return 0;
}