- CVI 정보나눔(www.cvi.kr)
- 스터디
- 질문답변
질문,답변
글 수 1,629
수고 많으십니다.
얼마전부터 cvi를 사용하기 시작하여 모르는게 넘 많습니다. 많은 도움 부탁드립니다.
현재 작업은 장비로부터 측정 데이터를 읽어 드려 그래프로 표현하는 작업을 하고 있습니다.
아래의 소스는 커서의 위치 정보를 알려 주는 그래프 콜백 함수입니다.
여기서 cursorY1과 cursorY2의 값을 읽어 드려...
예를 들어 a = cursorY1 / cursorY2를 계산하여 a를 출력하고자 합니다.
어떻게 해야 하는지 몰라 이렇게 문의를 드립니다.
감사합니다.
int CVICALLBACK Graph (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int activeCursor;
double cursorX1, cursorX2, cursorY1, cursorY2;
double a;
if ((event == EVENT_VAL_CHANGED)||(event == EVENT_COMMIT))
{
GetActiveGraphCursor (panelHandle, PANEL_GRAPH, &activeCursor);
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor, &cursorX1, &cursorY1);
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor, &cursorX2, &cursorY2);
if (activeCursor == 1)
{
SetCtrlVal (panelHandle, PANEL_I1, cursorX1);
SetCtrlVal (panelHandle, PANEL_V1, cursorY1);
}
else
{
SetCtrlVal (panelHandle, PANEL_I2, cursorX2);
SetCtrlVal (panelHandle, PANEL_V2, cursorY2);
}
}
return 0;
}
얼마전부터 cvi를 사용하기 시작하여 모르는게 넘 많습니다. 많은 도움 부탁드립니다.
현재 작업은 장비로부터 측정 데이터를 읽어 드려 그래프로 표현하는 작업을 하고 있습니다.
아래의 소스는 커서의 위치 정보를 알려 주는 그래프 콜백 함수입니다.
여기서 cursorY1과 cursorY2의 값을 읽어 드려...
예를 들어 a = cursorY1 / cursorY2를 계산하여 a를 출력하고자 합니다.
어떻게 해야 하는지 몰라 이렇게 문의를 드립니다.
감사합니다.
int CVICALLBACK Graph (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int activeCursor;
double cursorX1, cursorX2, cursorY1, cursorY2;
double a;
if ((event == EVENT_VAL_CHANGED)||(event == EVENT_COMMIT))
{
GetActiveGraphCursor (panelHandle, PANEL_GRAPH, &activeCursor);
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor, &cursorX1, &cursorY1);
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor, &cursorX2, &cursorY2);
if (activeCursor == 1)
{
SetCtrlVal (panelHandle, PANEL_I1, cursorX1);
SetCtrlVal (panelHandle, PANEL_V1, cursorY1);
}
else
{
SetCtrlVal (panelHandle, PANEL_I2, cursorX2);
SetCtrlVal (panelHandle, PANEL_V2, cursorY2);
}
}
return 0;
}
위의 소스에서 activeCursor가 같기 때문에 cursorX1 = cursorX2 , cursorY1 = cursorY2의 결과가 나올 것이라 생각됩니다.
uir에서 그래프의 커서를 두개를 만드신후에
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor1, &cursorX1, &cursorY1);
GetGraphCursor (panelHandle, PANEL_GRAPH, activeCursor2, &cursorX2, &cursorY2);
이렇게 사용하시면 될 것 같습니다.