硬汉嵌入式论坛

 找回密码
 立即注册
查看: 6040|回复: 10
收起左侧

[emWin] 使用GUIBuilder生成对话框代码,加入到工程无法显示,内详

[复制链接]

5

主题

16

回帖

5

积分

新手上路

积分
5
发表于 2014-5-28 21:41:53 | 显示全部楼层 |阅读模式
按照硬汉哥的教程,使用GUIBuilder生成了一个创建对话框的.c文件,加入到工程文件中,不能显示啊,经测试,无法进入到 WM_INIT_DIALOG进行出初始化对话框啊,求指教,还需要什么配置吗,还是我的移植不对呢。
switch (pMsg->MsgId)   {
    case WM_INIT_DIALOG://初始化对话框 内部控件        
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2014-5-28 23:09:44 | 显示全部楼层
完整的emwin程序我看看
回复

使用道具 举报

5

主题

16

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2014-5-29 08:48:30 | 显示全部楼层

回 eric2013 的帖子

eric2013:完整的emwin程序我看看 (2014-05-28 23:09) 
/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0, 0 },
  { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 5, 278, 80, 20, 0, 0, 0 },
  { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 137, 279, 80, 20, 0, 0, 0 },
  { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 73, 84, 80, 20, 0, 100, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
}

static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  // USER START (Optionally insert additional variables)
  // USER END
  //WM_HWIN hWin = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, "enter");
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_SetText(hItem, "back");
    //
    // Initialization of 'Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "123");
    // 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_BUTTON_0: // Notifications sent by 'Button'
      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;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Button'
      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;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_0: // Notifications sent by 'Edit'
      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_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;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateFramewin
*/
WM_HWIN CreateFramewin(void);
WM_HWIN CreateFramewin(void) {
  WM_HWIN hWin;

// hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbDialog, WM_HBKWIN, 0, 0);
hWin= GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbDialog, 0, 0, 0);
  return hWin;
}

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

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

main(void)
{
  //WM_HWIN hItem;
  /* Chip errata */
  CHIP_Init();
  cmuclk_Init();
  Systick_Delay_Init();
  NVIC_Init();

  GPIO_Init();
  
  GUI_Init();
WM_SetDesktopColor(GUI_RED);
WM_SetCreateFlags(WM_CF_MEMDEV);
CreateFramewin();
//WM_Paint(hWin);
         
while(1)
{

  WM_Exec();
}  
           
               

}
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2014-5-29 10:41:13 | 显示全部楼层
是你移植的问题:

1.png
回复

使用道具 举报

5

主题

16

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2014-5-29 12:02:13 | 显示全部楼层

回 eric2013 的帖子

eric2013:是你移植的问题:


 (2014-05-29 10:41) 
我正常的显示按钮控件什么的,都可以正常应用啊,包括显示字符什么的,这是哪里出现问题了呢
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2014-5-29 12:07:38 | 显示全部楼层

回 worldcui 的帖子

worldcui:我正常的显示按钮控件什么的,都可以正常应用啊,包括显示字符什么的,这是哪里出现问题了呢 (2014-05-29 12:02) 
你是指的不使用对话框可以正常显示吗
回复

使用道具 举报

5

主题

16

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2014-5-29 12:24:54 | 显示全部楼层

回 eric2013 的帖子

eric2013:你是指的不使用对话框可以正常显示吗 (2014-05-29 12:07) 
对的,我把按扭控件那个例子跑了一下,可以正常显示
回复

使用道具 举报

5

主题

16

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2014-5-29 12:25:22 | 显示全部楼层

回 eric2013 的帖子

eric2013:你是指的不使用对话框可以正常显示吗 (2014-05-29 12:07) 
就对话框不好使
回复

使用道具 举报

5

主题

16

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2014-5-29 15:03:37 | 显示全部楼层
搞定了,重新移植了一遍
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117542
QQ
发表于 2014-5-29 15:35:48 | 显示全部楼层

回 worldcui 的帖子

worldcui:搞定了,重新移植了一遍 (2014-05-29 15:03) 
解决了就好
回复

使用道具 举报

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

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-13 19:08 , Processed in 0.057999 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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