OpenEdv-开源电子网

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

对话框检测不到ICONVIEW发过来的消息,这是为何?

[复制链接]

21

主题

51

帖子

0

精华

初级会员

Rank: 2

积分
140
金钱
140
注册时间
2015-12-4
在线时间
10 小时
发表于 2016-1-6 15:58:18 | 显示全部楼层 |阅读模式
1金钱
我的代码示例如下:
/**********************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
***********************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.28                          *
*        Compiled Jan 30 2015, 16:41:06                              *
*        (c) 2015 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
***********************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
***********************************************
*/

// USER START (Optionally insert additional includes)
// USER END

#include "DIALOG.h"
#include "3d_main.h"
#include "adjust.h"
#include "information.h"
#include "status.h"
#include "language.h"
#include "set_up.h"
#include "wifi.h"
#include "return.h"
#include "usart.h"


/**********************************************
*
*       Defines
*
***********************************************
*/
#define ID_FRAMEWIN_2  (GUI_ID_USER + 0x15)
#define ID_ICONVIEW_0  (GUI_ID_USER + 0x16)


// USER START (Optionally insert additional defines)
// USER END

/**********************************************
*
*       Static data
*
***********************************************
*/

// USER START (Optionally insert additional static data)
// USER END

/**********************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate_system[] = {
  { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_2, 0, 0, 800, 480, 0, 0x0, 0 },

  // USER START (Optionally insert additional widgets)
  // USER END
};

/**********************************************
*
*       Static code
*
***********************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/**********************************************
*
*       _cbDialog
*/
static void _cbDialog_system(WM_MESSAGE * pMsg) {
       
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  printf("This is a test_1\r\n");
  switch (pMsg->MsgId) {
          
          case WM_INIT_DIALOG:
                        printf("This is a test_2\r\n");
                        // Initialization of 'Framewin'
                        hItem = pMsg->hWin;   //pMsg->hWin是对话框的句柄
                        FRAMEWIN_SetTitleVis(hItem, 0);
                        break;
          
          case WM_NOTIFY_PARENT:
                        Id    = WM_GetId(pMsg->hWinSrc);  //pMsg->hWinSrc是ICONVIEW控件的句柄
                        printf("id: %d\r\n",Id);
                        NCode = pMsg->Data.v;
                        printf("This is a test_3\r\n");
          
                        switch(Id) {
                                  case ID_ICONVIEW_0: // Notifications sent by 'Iconview'
                                                  printf("This is a test_4\r\n");
                                                  switch(NCode) {                       
                                                            case WM_NOTIFICATION_CLICKED:
                                                                        break;
                                                            case WM_NOTIFICATION_RELEASED:  //这个小工具的释放,是指整个ICONVIEW的释放;
                                                                        break;
                                                                case WM_NOTIFICATION_MOVED_OUT:
                                                                        break;
                                                                case WM_NOTIFICATION_SCROLL_CHANGED:
                                                                        break;
                                                                case WM_NOTIFICATION_SEL_CHANGED:
                                                                        printf("This is a test_5\r\n");          
                                                                        switch(ICONVIEW_GetSel(pMsg->hWinSrc))
                                                                        {
                                                                                /* 机器状态 */
                                                                                case 0:
                                                                                        break;       
                                                                               
                                                                                /* 机器信息 */
                                                                                case 1:
                                                                                                               
                                                                                        break;       
                                                                               
                                                                                /* 中英文切换 */
                                                                                case 2:
                                                                                                       
                                                                                        break;       
                                                                               
                                                                                /* 设置 */
                                                                                case 3:
                                                                                       
                                                                                        break;
                                                                               
                                                                                /* 屏幕校准 */
                                                                                case 4:
                                                                                       
                                                                                        break;       
                                                                               
                                                                                /* Wifi */
                                                                                case 5:
                                                                                                               
                                                                                        break;       
                                                                               
                                                                                /* 返回上一层界面 */
                                                                                case 6:
                                                                                        printf("This is a test_6\r\n");
                                                                                        CreateFramewin_main();                               
                                                                                        break;       
                                                                               
                                                                                default:
                                                                                        printf("This is a test_7\r\n");
                                                                                        break;
                                                                        }
                                                                        break;
                                                }
                                                break;
                                }
                                break;
                               
                  default:
                        WM_DefaultProc(pMsg);
                        break;

  }


}

/**********************************************
*
*       Public code
*
***********************************************
*/
/**********************************************
*
*       CreateFramewin
*/

WM_HWIN CreateFramewin_system(void) {
       
        WM_HWIN hWin;
        ICONVIEW_Handle  IH;
       
        hWin = GUI_CreateDialogBox(_aDialogCreate_system, GUI_COUNTOF(_aDialogCreate_system), _cbDialog_system, 0, 0, 0);  //创建对话框
        IH = ICONVIEW_CreateEx(0, 0,800, 480,hWin, WM_CF_SHOW,ICONVIEW_CF_AUTOSCROLLBAR_V, ID_ICONVIEW_0,160, 120);   //创建ICONVIEW控件
        ICONVIEW_SetSpace(IH,GUI_COORD_X,40);   //以边界为基准;
        ICONVIEW_SetSpace(IH,GUI_COORD_Y,40);
        ICONVIEW_SetFrame(IH,GUI_COORD_X,40);
        ICONVIEW_SetFrame(IH,GUI_COORD_Y,40);

        ICONVIEW_AddBitmapItem(IH,&bm5,"Status");
        ICONVIEW_AddBitmapItem(IH,&bm6,"Information");
        ICONVIEW_AddBitmapItem(IH,&bm7,"Language");
        ICONVIEW_AddBitmapItem(IH,&bm8,"Set_up");
        ICONVIEW_AddBitmapItem(IH,&bm9,"Adjust");
        ICONVIEW_AddBitmapItem(IH,&bm10,"Wifi");
        ICONVIEW_AddBitmapItem(IH,&bm11,"Return");

        return hWin;
       
}

// USER START (Optionally insert additional public code)
// USER END

/****************** End of file *******************/



注:不知为何,我用串口打印消息时,只能打印出test_1和test_2,当我点击ICONVIEW小工具上的其中任意一个图标时,始终打印不出test_3,
说明ICONVIEW始终没有发消息指对话框,这是为何呢?难道我的ICONVIEW控件的用法用错了?求大神指点指点...

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165371
金钱
165371
注册时间
2010-12-1
在线时间
2110 小时
发表于 2016-1-7 23:09:44 | 显示全部楼层
回复

使用道具 举报

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

本版积分规则



关闭

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

正点原子公众号

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

GMT+8, 2025-2-25 21:37

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

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