Keyboard in emwin with a background image

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Not able to return back

      I created a keyboard using buttons.It uses a main window,an edit window and a dialog box for keyboard. After pressing enter it should return back with the text in the edit window. I tried using "deletewindow" but it wouldnt work. Please help.

      This is my code portion handling keyboard

      static void _cbKeybord(WM_MESSAGE * pMsg) {
      GUI_RECT Rect;
      WM_HWIN hItem;
      WM_HWIN hParent;
      int NCode;
      int Id;
      int i;
      char c;
      char acTextSrc[100 + 1];
      char acTextDest[100 + 1];
      int Len;


      switch (pMsg->MsgId) {
      case WM_INIT_DIALOG:

      for (i = 0; i <= ID_BUTTON_34 - ID_BUTTON_0; i++) {

      hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0 + i);


      WM_SetCallback(hItem, _cbButton);
      }
      break;
      case WM_PAINT:

      GUI_SetBkColor(GUI_LIGHTGRAY);
      GUI_Clear();
      WM_GetClientRect(&Rect);
      //GUI_DrawBitmap(&bmeditwindow,0,0);
      GUI_DrawBitmap(&bmwindow,0,1);

      break;
      case WM_NOTIFY_PARENT:
      Id = WM_GetId(pMsg->hWinSrc);
      NCode = pMsg->Data.v;
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

      hParent = WM_GetParent(pMsg->hWin);

      hItem = WM_GetDialogItem(hParent, ID_EDIT_0);

      WM_SetFocus(hItem);
      if (Id < ID_BUTTON_26) {

      c = 'A' + (Id - ID_BUTTON_0);

      GUI_StoreKeyMsg(c, 1);
      GUI_StoreKeyMsg(c, 0);
      }
      else if (Id == ID_BUTTON_26) // back Space
      {

      EDIT_GetText(hItem, acTextSrc, sizeof(acTextSrc)); // Get
      Len = strlen(acTextSrc);
      if (Len > 0) {
      acTextSrc[Len - 1] = '\0'; // Adapt
      EDIT_SetText(hItem, acTextSrc); // Write back
      }
      }
      else if (Id == ID_BUTTON_27) //Clr button - not needed at present
      {
      // EDIT_SetText(hItem, "");
      }
      else if (Id == ID_BUTTON_31) //Shift Key To do
      {
      _hKeyboard = GUI_CreateDialogBox(_aSmallBoardDialogCreate, GUI_COUNTOF(_aSmallBoardDialogCreate), _cbsmallbord, hWin, 0, 0);
      // EDIT_SetText(hItem, "");
      }
      else if (Id == ID_BUTTON_30) //ABC Button - To do
      {
      start_keyboard = KEYPAD_NUM;
      //GUI_ScreenKeypad_t211();
      _hKeyboard = GUI_CreateDialogBox(_aNumBoardDialogCreate, GUI_COUNTOF(_aNumBoardDialogCreate), _cbNumbord, hWin, 0, 0);
      }
      else if (Id == ID_BUTTON_32) //Left Arrow Key
      {
      EDIT_AddKey(hItem,GUI_KEY_LEFT);
      //EDIT_SetText(hItem, acTextSrc);
      }
      else if (Id == ID_BUTTON_33) //Right arrow key
      {
      EDIT_AddKey(hItem,GUI_KEY_RIGHT);
      }
      else if (Id == ID_BUTTON_34) //Enter Button
      {

      EDIT_GetText(hItem, acTextSrc, sizeof(acTextSrc));
      memcpy(UserOrpass,acTextSrc,sizeof(acTextSrc));
      enter_pressed = 1;
      WM_DeleteWindow(pMsg->hWin);

      }
      else if (Id == ID_BUTTON_28)
      { // Space button
      c = ' '; // Same as other characters
      GUI_StoreKeyMsg(c, 1);
      GUI_StoreKeyMsg(c, 0);

      }
      break;
      }
      break;
      default:
      WM_DefaultProc(pMsg);
      break;
      }
      }

      The post was edited 3 times, last by reshma.s ().