硬汉嵌入式论坛

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

[emWin] 窗口管理对比

[复制链接]

100

主题

94

回帖

394

积分

高级会员

积分
394
发表于 2024-11-11 15:40:09 | 显示全部楼层 |阅读模式

WM_CreateWindowAsChild(xPos, yPos, xSize, ySize, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, _cbWin1, 0);


GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbWin2, hParent, 0, 0);

_cbWin1 ,_cbWin2,这两个回调函数实现机制有啥区别?
我想在 WM_CreateWindowAsChild 的_cbWin1 管理按钮、文本框等操作,找到了例程序(如下),但是不知道ID_BUTTON_0 是什么时候被注册的?

static void _cbWin(WM_MESSAGE * pMsg) {
  GUI_RECT   Rect;
  int        Id;
  int        NCode;
  int        ReleasedItem;
  int        ActiveWindow;
  
  switch (pMsg->MsgId) {
  case WM_PAINT:
    //
    // Draw a thin black frame around the SWIPELIST
    //
    WM_GetClientRect(&Rect);
    GUI_SetColor(GUI_BLACK);
    GUI_AA_DrawRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 5);
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    //
    // If the button gets released we start an animation
    //
    case ID_BUTTON_0:
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        _CreateAnim(&_hAnim, &_Data, _AnimSwipeInOut);
        break;
      }
      break;
    case ID_SWIPELIST_0:
      switch (NCode) {
      //
      // An item has been reeleased
      //
      case WM_NOTIFICATION_RELEASED:
        //
        // Receive the ID of the item which has been released
        //
        ReleasedItem = SWIPELIST_GetReleasedItem(pMsg->hWinSrc);
        ActiveWindow = SWIPELIST_GetItemUserData(pMsg->hWinSrc, ReleasedItem);
        //
        // if it is different to the active window or not present
        //
        if ((_aDataWindow.ActiveItem != ActiveWindow) || (_aDataWindow.Data.Dir == 0)) {
          _DoAnimation = 1;
          //
          // If it is not displayed already, create an animation
          //
          if (_aDataWindow.Data.Dir == 0) {
            _CreateAnim(&_aDataWindow.hAnim, &_aDataWindow.Data, _AnimMoveWindows);
          }
          //
          // Remeber the active window
          //
          _aDataWindow.ActiveItem = ActiveWindow;
        }
        break;
      }
    break;
    }
  default:
    WM_DefaultProc(pMsg);
  }
}


回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
116230
QQ
发表于 2024-11-11 16:24:16 | 显示全部楼层
WM_CreateWindowAsChild麻烦,需要单独为这个窗口上创建控件。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-10 17:30 , Processed in 0.233776 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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