Problems with QR Code [Solved]

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

    • Problems with QR Code [Solved]

      Hello everybody,

      I have a problem with drawing QR Codes.
      I orientated myself on your example "GUI_QRCode.c" but it does not draw anything. I tried to draw a rectangle/polygon instead but this also fails. What could it be?
      Graphs, tables and so on are working fine.

      Thank you very much

      C Source Code

      1. static void _cbScreen5(WM_MESSAGE * pMsg)
      2. {
      3. WM_HWIN hItem;
      4. GUI_HMEM hQR;
      5. int NCode,Id;
      6. switch (pMsg->MsgId)
      7. {
      8. case WM_INIT_DIALOG:
      9. hItem = pMsg->hWin;
      10. WINDOW_SetBkColor(hItem, GUI_WHITE);
      11. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_50);
      12. TEXT_SetTextAlign(hItem, TEXT_CF_LEFT);
      13. TEXT_SetTextColor(hItem, GUI_BLUE);
      14. TEXT_SetFont(hItem, GUI_FONT_24B_1);
      15. hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_BACK_MENU_5);
      16. BUTTON_SetText(hItem, "Menu");
      17. BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX);
      18. hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_SCREEN_5);
      19. BUTTON_SetText(hItem, "Screen 2 ");
      20. GUI_SetColor(GUI_BLACK);
      21. hQR = GUI_QR_Create("www.google.com", 5, GUI_QR_ECLEVEL_Q, 0);
      22. GUI_QR_Draw(hQR, 10, 10);
      23. break;
      24. case WM_NOTIFY_PARENT:
      25. Id = WM_GetId(pMsg->hWinSrc);
      26. NCode = pMsg->Data.v;
      27. switch(Id) {
      28. case ID_BUTTON_SCREEN_5: // Notifications sent by 'Iconview'
      29. switch(NCode)
      30. {
      31. case WM_NOTIFICATION_CLICKED:
      32. break;
      33. case WM_NOTIFICATION_RELEASED:
      34. WM_HideWindow(pMsg->hWin);
      35. WM_ShowWindow(hScreen2);
      36. break;
      37. }
      38. break;
      39. case ID_BUTTON_BACK_MENU_5:
      40. switch(NCode)
      41. {
      42. case WM_NOTIFICATION_RELEASED:
      43. WM_HideWindow(pMsg->hWin);
      44. WM_ShowWindow(hDialog);
      45. break;
      46. }
      47. break;
      48. }
      49. default:
      50. WM_DefaultProc(pMsg);
      51. break;
      52. }
      53. }
      Display All
    • Hi,

      it should work when calling GUI_QR_Draw() in a WM_PAINT case instead of WM_INIT_DIALOG. In fact, you should only draw inside of a WM_PAINT case when using the Window Manager, or otherwise it won't work properly.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.