新手上路
- 积分
- 29
- 金钱
- 29
- 注册时间
- 2014-4-3
- 在线时间
- 0 小时
|
我要实现的功能是点正弦按键的时候显示正弦波,按方波按键显示方波。现在的问题是只点击其中一个都正常,先点其中一个再点另一个就会两个波形都出现。我觉得应该是原来的数据项没有删除,所以调用了GRAPH_DATA_YT_Clear,结果直接异常了。。。。求解决,谢谢。前两个button都能正常工作,但是一按第三个立刻就异常了 也就是这句话:GRAPH_DATA_YT_Clear(hData);
相关代码如下:
case ID_BUTTON_14: // Notifications sent by '正弦波¨'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
convert_sin();//计算正弦表
hData=GRAPH_DATA_YT_Create(GUI_RED,200,wave_data,200);
GRAPH_DATA_YT_SetOffY(hData, 60);
GRAPH_DATA_YT_SetAlign(hData, GRAPH_ALIGN_LEFT);
hItem = WM_GetDialogItem(pMsg->hWin, ID_GRAPH_0);
GRAPH_SetGridDistX(hItem, 10);
GRAPH_SetGridDistY(hItem, 10);
GRAPH_SetGridVis(hItem, 1);
GRAPH_AttachData(hItem, hData);
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_15: // Notifications sent by '·方波¨'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
convert_square();
hData=GRAPH_DATA_YT_Create(GUI_RED,200,wave_data,200);
GRAPH_DATA_YT_SetOffY(hData, 60);
GRAPH_DATA_YT_SetAlign(hData, GRAPH_ALIGN_LEFT);
hItem = WM_GetDialogItem(pMsg->hWin, ID_GRAPH_0);
GRAPH_SetGridDistX(hItem, 10);
GRAPH_SetGridDistY(hItem, 10);
GRAPH_SetGridVis(hItem, 1);
GRAPH_AttachData(hItem, hData);
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_16: // Notifications sent by '清除graph'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// hData=GRAPH_DATA_YT_Create(GUI_RED,200,wave_data,200);
// hItem = WM_GetDialogItem(pMsg->hWin, ID_GRAPH_0);
GRAPH_DetachData(hItem, hData);
GRAPH_DATA_YT_Clear(hData);
// GRAPH_DetachData(hItem, hData);
// GRAPH_DATA_YT_Delete(hData);
// WM_DeleteWindow(hItem);
// hItem = WM_GetDialogItem(pMsg->hWin, ID_GRAPH_0);
// GRAPH_SetBorder(hItem, 2, 2, 2, 2);
// hItem = GRAPH_CreateEx(120, 60, 200, 130, WM_HBKWIN, WM_CF_SHOW, 0, ID_GRAPH_0);
// hData = GRAPH_DATA_YT_Create(GUI_RED,200,wave_data,200);
// GRAPH_AttachData(hGraph, hData);
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
// USER END
}
break; |
|