DROPDOWN : Reaction on click

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

    • DROPDOWN : Reaction on click

      Hi

      I have a functionality problem regarding DROPDOWN widget.

      Description:

      I have a dialog full of dropdown and edit widgets. There is an Edit widget placed below a dropdown widget. I have implemented a virtual keyboard that is triggered when an Edit widget is touched.
      The problem arise when the Dropdown is opened and after selecting an item that is "over" the Edit widget (below) the Dropdown is closed and then the Edit is now selected and the virtual keyboard is triggered. This is very annoying. I would like to trigger the Edit widget after a "no touch" detection precedes any notification send to the Edit widget.
      Any other solution for this situation will be appreciated.

      Best Regards
    • Hi,

      you can set a callback for the DROPDOWN and disable the EDIT whenever the dropdown is opened/closed. DROPDOWN_GetListbox() checks if there is an attached LISTBOX widget to the dropdown, if so, we know that the dropdown is expanded.

      C Source Code

      1. static void _cbDropdown(WM_MESSAGE * pMsg) {
      2. WM_HWIN hButton;
      3. switch(pMsg->MsgId) {
      4. case WM_TOUCH:
      5. //
      6. // Check if DROPDOWN is open
      7. //
      8. hButton = WM_GetDialogItem(WM_GetParent(pMsg->hWin), GUI_ID_BUTTON0);
      9. if(DROPDOWN_GetListbox(pMsg->hWin)) { // open
      10. WM_DisableWindow(hButton);
      11. } else { // closed
      12. WM_EnableWindow(hButton);
      13. }
      14. DROPDOWN_Callback(pMsg);
      15. break;
      16. default:
      17. DROPDOWN_Callback(pMsg);
      18. }
      19. }
      Display All

      You also have to enable the EDIT after a selection to the dropdown was made.

      C Source Code

      1. case WM_NOTIFY_PARENT:
      2. Id = WM_GetId(pMsg->hWinSrc);
      3. NCode = pMsg->Data.v;
      4. switch(Id) {
      5. case GUI_ID_DROPDOWN0:
      6. switch(NCode) {
      7. case WM_NOTIFICATION_SEL_CHANGED:
      8. //
      9. // Enable button again
      10. //
      11. hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0);
      12. WM_EnableWindow(hItem);
      13. break;
      14. }
      15. break;
      16. }
      17. break;
      Display All

      Best regards,

      Florian