OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6547|回复: 3

【emwin】GRAPH_DATA_YT_Clear调用异常

[复制链接]

1

主题

5

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2014-4-3
在线时间
0 小时
发表于 2014-5-4 09:30:09 | 显示全部楼层 |阅读模式
我要实现的功能是点正弦按键的时候显示正弦波,按方波按键显示方波。现在的问题是只点击其中一个都正常,先点其中一个再点另一个就会两个波形都出现。我觉得应该是原来的数据项没有删除,所以调用了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;
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

5

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2014-4-3
在线时间
0 小时
 楼主| 发表于 2014-5-4 11:03:31 | 显示全部楼层
怎么没有人回复呢??求帮助啊
回复 支持 反对

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165309
金钱
165309
注册时间
2010-12-1
在线时间
2108 小时
发表于 2014-5-4 11:14:38 | 显示全部楼层
帮顶
回复 支持 反对

使用道具 举报

1

主题

5

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2014-4-3
在线时间
0 小时
 楼主| 发表于 2014-5-4 12:32:02 | 显示全部楼层
回复【3楼】正点原子:
---------------------------------
谢谢站长
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-22 09:19

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表