你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

emWin multipage如何关闭?

[复制链接]
xiang90721 提问时间:2017-5-7 20:00 /
悬赏5ST金币未解决
主界面上有icon,点击icon后建立一个frame,然后这个frame上有两个控件,一个 ok button和一个multipage,multipage中有三个页面,问题是如何关闭frame回到主界面?
原本想按ok button关闭frame回到主界面?但在vs仿真执行就出现dereference free block in GUI_ALLC_h2p()错误,求解?
贴出回调函数代码,大家帮忙看看,谢谢:
这个是multipage的第一个页面的回调函数,这个页面就是一个button,想按这个button销毁frame回到主界面上,但是不行
static void _cbDialog_Page1(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  WM_HWIN hItem2;
  int     NCode;
  int     Id;
  WM_MESSAGE msg;
  // USER START (Optionally insert additional variables)
  // USER END


  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0);
    BUTTON_SetSkin(hItem, _DrawSkin_Button);


    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case GUI_ID_BUTTON0: // Notifications sent by 'Checkbox'
      switch(pMsg->Data.v) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        #if 0
                hItem = WM_GetParent(pMsg->hWin);
        hItem2 = WM_GetParent(hItem );
        hItem = MULTIPAGE_GetWindow(hItem2,0);
        WM_DeleteWindow(hItem);
        hItem = MULTIPAGE_GetWindow(hItem2,1);
        WM_DeleteWindow(hItem);
        hItem = MULTIPAGE_GetWindow(hItem2,2);
        WM_DeleteWindow(hItem);
        GUI_EndDialog(hItem2, 0);
        #endif
        hItem = (WM_GetParent(WM_GetParent(pMsg->hWin)));
        hItem2 = WM_GetParent(hItem );
        WM_DeleteWindow(hItem);
        //GUI_EndDialog(hItem2, 0);
        msg.MsgId = WM_DELETE;
        WM_SendMessage(hItem2,&msg);
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // 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;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}




这个是frame的回调函数,frame中有个button,想按这个button销毁frame回到主界面也是不行。求解啊
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  WM_HWIN hItem2;
  WM_HWIN hDialog;
  WM_MESSAGE msg;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  // USER END


  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Multipage'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE_0);


    hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), _cbDialog_Page1,       WM_UNATTACHED, 0, 0);
    //WM_SetCallback(hDialog, _cbDialog_Page1);
    MULTIPAGE_AddPage(hItem, hDialog, "setup1");
    GUI_Delay(500);
    hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL,       WM_UNATTACHED, 0, 0);
    MULTIPAGE_AddPage(hItem, hDialog, "setup2");
    GUI_Delay(500);
    hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL,       WM_UNATTACHED, 0, 0);
    MULTIPAGE_AddPage(hItem, hDialog, "about");
    GUI_Delay(500);
    //
    // Initialization of 'OK'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetFont(hItem, GUI_FONT_16_ASCII);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_MULTIPAGE_0: // Notifications sent by 'Multipage'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // 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_0: // Notifications sent by 'OK'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        //hItem2 = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE_0);


        //hItem = MULTIPAGE_GetWindow(hItem2,0);
        //WM_DeleteWindow(hItem);
        //hItem = MULTIPAGE_GetWindow(hItem2,1);
        //WM_DeleteWindow(hItem);
        //hItem = MULTIPAGE_GetWindow(hItem2,2);
        //WM_DeleteWindow(hItem);
        hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE_0);
        WM_DeleteWindow(hItem);
        hItem = WM_GetParent(pMsg->hWin);
        WM_DeleteWindow(hItem, 0);        
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}


收藏 2 评论2 发布时间:2017-5-7 20:00

举报

2个回答
wenyangzeng 回答时间:2018-5-14 09:40:19
只要多建一个“返回键”控件就可以了。

评分

参与人数 1蝴蝶豆 +3 收起 理由
zero99 + 3

查看全部评分

wolfgang 回答时间:2018-5-14 11:10:32
页面绘制和菜单控制的问题了,返回就要做上一级页面的重绘制。
内存有富余的就要开辟内存缓冲区,不富裕的就调用Flash上级页面;
另外有动态显示的内容,还得加动态数据窗口,显示返回值。

评分

参与人数 1蝴蝶豆 +3 收起 理由
zero99 + 3

查看全部评分

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32Cube扩展软件包
意法半导体边缘AI套件
ST - 理想汽车豪华SUV案例
ST意法半导体智能家居案例
STM32 ARM Cortex 32位微控制器
关注我们
st-img 微信公众号
st-img 手机版