嵌入式学习小组
直播中

任青

7年用户 182经验值
私信 关注

请问ucgui怎么点击edit出现一个窗体?

我做了一个界面,有几个edit,我想点击edit出现一个键盘,但是我不知道怎么获取我点击了哪个edit,求大虾指教,谢谢

回帖(2)

朱艳丽

2019-10-14 09:10:31
在回调函数里面写。一般用GUIBUILDER都会自动生成相应的空回调函数,如果没有就添加进去
比如我随便生成了一个有2个button的窗口
[C] 纯文本查看 复制代码
/**********************************************************************                                                                    **                SEGGER Microcontroller GmbH & Co. KG                **        Solutions for real time microcontroller applications        **                                                                    ************************************************************************                                                                    ** C-file generated by:                                               **                                                                    **        GUI_Builder for emWin version 5.26                          **        Compiled Aug 18 2014, 17:12:05                              **        (c) 2014 Segger Microcontroller GmbH & Co. KG               **                                                                    ************************************************************************                                                                    **        Internet: www.segger.com  Support: support@segger.com       **                                                                    ************************************************************************/// USER START (Optionally insert additional includes)// USER END#include "DIALOG.h"/***********************************************************************       Defines************************************************************************/#define ID_FRAMEWIN_0    (GUI_ID_USER + 0x00)#define ID_BUTTON_0    (GUI_ID_USER + 0x01)#define ID_BUTTON_1    (GUI_ID_USER + 0x02)// 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[] = {  { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 320, 240, 0, 0x0, 0 },  { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 23, 26, 80, 20, 0, 0x0, 0 },  { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 23, 76, 80, 20, 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(WM_MESSAGE * pMsg) {  int NCode;  int Id;  // USER START (Optionally insert additional variables)  // USER END  switch (pMsg->MsgId) {  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;    // 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);  return hWin;}// USER START (Optionally insert additional public code)// USER END/*************************** End of file ****************************/
这里面只要在case ID_BUTTON_1:的case WM_NOTIFICATION_RELEASED:这里面添加相应函数就行了
举报

张鹏

2019-10-14 09:19:35
我要点击EDIT后触发,不是点击按钮后弹出另外一个窗体
举报

更多回帖

发帖
×
20
完善资料,
赚取积分