Content originally posted in LPCWare by ankit.sciter on Mon Feb 08 01:49:51 MST 2016 I can call the FRAMEWIN_AddButton to put a button on the titlebar. The button appears, and I can use the window handle to set text and resize it. I can't seem to figure out what event is triggered by clicking the button. It doesn't seem to fire a notification on it's ID in the FRAMEWIN's _cbDialog. for that i have used wm_setcallback() to receive events of buttons.i received button event successfully using custom callback function.
My problem is that framewindow's outer border is gone after using wm_setcallback().please refer my code below:
/********************************************************************* * * * SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * * * ********************************************************************** * * * C-file generated by: * * * * GUI_Builder for emWin version 5.22 * * Compiled Jul 4 2013, 15:16:01 * * (c) 2013 Segger Microcontroller GmbH & Co. KG * * * ********************************************************************** * * * Internet: www.segger.com Support: support@segger.com * * * ********************************************************************** */
// USER START (Optionally insert additional includes) // USER END
// USER START (Optionally insert additional static code) // USER END
static void _btncb1(WM_MESSAGE * pMsg) { WM_HWIN hItem; 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 WM_TOUCH: // Notifications sent by 'Listview' 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_SEL_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; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; WM_HWIN hChild; // USER START (Optionally insert additional variables) // USER END printf("\r\n\pMsg->MsgId is:%d\n\r",pMsg->MsgId); switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'Lawless' // GUI_SetBkColor(GUI_BLUE); GUI_Clear(); printf("\r\nInitialization of 'Lawless'\n\r"); hItem = pMsg->hWin;
switch(Id) { case ID_LISTVIEW_0: // Notifications sent by 'Listview' 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_SEL_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; } }