SLIDER - How to UNDO Focus??

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

  • SLIDER - How to UNDO Focus??

    Hi All,

    I believe I am seeing this with other Widgets as well, but currently I'm just trying to get a simple SLIDER widget working, with an OK and Cancel button on the same window...

    I'm using an STM32H7 with a 5.0" Touch LCD screen ONLY, there is NO keyboard or anything else involved.

    The OK/Cancel will work fine as long as you don't touch on the SLIDER, once you do, the slider is forever focussed, and no matter where I touch on the entire LCD screen, the SLIDER remains focussed...


    This is simple code generated from the GUI builder, just a slider and button...

    C Source Code

    1. /*********************************************************************
    2. * *
    3. * SEGGER Microcontroller GmbH & Co. KG *
    4. * Solutions for real time microcontroller applications *
    5. * *
    6. **********************************************************************
    7. * *
    8. * C-file generated by: *
    9. * *
    10. * GUI_Builder for emWin version 5.32 *
    11. * Compiled Oct 8 2015, 11:59:02 *
    12. * (c) 2015 Segger Microcontroller GmbH & Co. KG *
    13. * *
    14. **********************************************************************
    15. * *
    16. * Internet: www.segger.com Support: support@segger.com *
    17. * *
    18. **********************************************************************
    19. */
    20. // USER START (Optionally insert additional includes)
    21. // USER END
    22. #include "DIALOG.h"
    23. /*********************************************************************
    24. *
    25. * Defines
    26. *
    27. **********************************************************************
    28. */
    29. #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
    30. #define ID_SLIDER_0 (GUI_ID_USER + 0x01)
    31. #define ID_BUTTON_OK (GUI_ID_USER + 0x02)
    32. // USER START (Optionally insert additional defines)
    33. // USER END
    34. /*********************************************************************
    35. *
    36. * Static data
    37. *
    38. **********************************************************************
    39. */
    40. // USER START (Optionally insert additional static data)
    41. // USER END
    42. /*********************************************************************
    43. *
    44. * _aDialogCreate
    45. */
    46. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    47. { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 800, 480, 0, 0x0, 0 },
    48. { SLIDER_CreateIndirect, "Slider", ID_SLIDER_0, 189, 160, 391, 89, 0, 0x0, 0 },
    49. { BUTTON_CreateIndirect, "Button", ID_BUTTON_OK, 13, 366, 130, 50, 0, 0x0, 0 },
    50. // USER START (Optionally insert additional widgets)
    51. // USER END
    52. };
    53. /*********************************************************************
    54. *
    55. * Static code
    56. *
    57. **********************************************************************
    58. */
    59. // USER START (Optionally insert additional static code)
    60. // USER END
    61. /*********************************************************************
    62. *
    63. * _cbDialog
    64. */
    65. static void _cbDialog(WM_MESSAGE * pMsg) {
    66. int NCode;
    67. int Id;
    68. // USER START (Optionally insert additional variables)
    69. // USER END
    70. switch (pMsg->MsgId) {
    71. case WM_NOTIFY_PARENT:
    72. Id = WM_GetId(pMsg->hWinSrc);
    73. NCode = pMsg->Data.v;
    74. switch(Id)
    75. {
    76. case ID_BUTTON_OK: // Notifications sent by 'Button'
    77. switch(NCode)
    78. {
    79. case WM_NOTIFICATION_CLICKED:
    80. break;
    81. }
    82. break;
    83. case ID_SLIDER_0: // Notifications sent by 'Slider'
    84. switch(NCode)
    85. {
    86. case WM_NOTIFICATION_CLICKED:
    87. // USER START (Optionally insert code for reacting on notification message)
    88. // USER END
    89. break;
    90. case WM_NOTIFICATION_RELEASED:
    91. // USER START (Optionally insert code for reacting on notification message)
    92. // USER END
    93. break;
    94. case WM_NOTIFICATION_VALUE_CHANGED:
    95. // USER START (Optionally insert code for reacting on notification message)
    96. // USER END
    97. break;
    98. // USER START (Optionally insert additional code for further notification handling)
    99. // USER END
    100. }
    101. break;
    102. // USER START (Optionally insert additional code for further Ids)
    103. // USER END
    104. }
    105. break;
    106. // USER START (Optionally insert additional message handling)
    107. // USER END
    108. default:
    109. WM_DefaultProc(pMsg);
    110. break;
    111. }
    112. }
    113. /*********************************************************************
    114. *
    115. * Public code
    116. *
    117. **********************************************************************
    118. */
    119. /*********************************************************************
    120. *
    121. * CreateWindow
    122. */
    123. WM_HWIN CreateWindow(void);
    124. WM_HWIN CreateWindow(void) {
    125. WM_HWIN hWin;
    126. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
    127. while(1) {
    128. GUI_Exec();
    129. }
    130. }
    131. // USER START (Optionally insert additional public code)
    132. // USER END
    133. /*************************** End of file ****************************/
    Display All


    NOTE: I also see the same behavior if I just build and run the "DIALOG_SliderColor.c" sample that comes with the STemWin release...


    So how do I UN-FOCUS the widget so I can touch another widget (without having an actual keyboard)????
  • Do I just need to send a 'WM_NOTIFICATION_RELEASED' msg to the window to release the widget?
    (since I only have an lcd touchscreen, and no hardware buttons that actually release??)



    Ok, so I'm guessing this is all related to my touch setup, my LCD has a built-in touch controller (FT5246), so I'm using the touch interrupt to call my touch_ISR, in which I read the touch contents, and call the 'GUI_TOUCH_StoreState()' with the touch co-ordinates.

    But I'm guessing there should also be 'touch released' events (I see these 'PUT UP/PUT DOWN' events mentioned in the PDF)... I'm only reporting touch 'events' via this call, so I guess that would explain why my WIDGETS are never RELEASED?

    I see from all the examples most have a 'polling' period to instead read any touch points, and report back 'unpressed' status if none are found, but makes more sense to me to handle touch right from the driven interrupt, versus polling them..

    Am I correct here, in that my controller probably reports when the contact with the screen is lifted? ie that is probably a 'PUT UP' event?

    The post was edited 1 time, last by MikeFlyersFan ().