DROPDOWN widget select BUG

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

    • DROPDOWN widget select BUG

      Hi,

      When I using DROPDOWN_SetItemDisabled disable some items of the DROPDOWN widget , UP and DOWM key still CAN select disabled items if it focused.
      When the DROPDOWN widget in expand mode, Disabled items cannot be selected.

      Regards,
      Chensie
    • Hi,

      Thanks for pointing this one out.

      We will fix this behavior. In the meanwhile you can use the workaround below. You have to set a custom callback for the DRAOPDOWN widget and react on WM_KEY. If the selection is disabled set a new selection.

      Set the callback below with WM_SetCallback(hDropdown, _cbDropdown);

      C Source Code

      1. /*********************************************************************
      2. *
      3. * _cbDropdown
      4. */
      5. static void _cbDropdown(WM_MESSAGE * pMsg) {
      6. WM_KEY_INFO * pInfo;
      7. static int OldSel;
      8. int NewSel;
      9. int NumIndexes;
      10. switch (pMsg->MsgId) {
      11. case WM_KEY:
      12. pInfo = (WM_KEY_INFO *)pMsg->Data.p;
      13. if (pInfo) {
      14. if (pInfo->PressedCnt) {
      15. OldSel = DROPDOWN_GetSel(pMsg->hWin);
      16. DROPDOWN_Callback(pMsg);
      17. NewSel = DROPDOWN_GetSel(pMsg->hWin);
      18. NumIndexes = DROPDOWN_GetNumItems(pMsg->hWin) - 1;
      19. while (DROPDOWN_GetItemDisabled(pMsg->hWin, NewSel)) {
      20. if (NewSel < OldSel) {
      21. NewSel = (NewSel > 0) ? NewSel - 1 : OldSel;
      22. } else if (NewSel > OldSel) {
      23. NewSel = (NewSel < NumIndexes) ? NewSel + 1 : OldSel;
      24. }
      25. }
      26. DROPDOWN_SetSel(pMsg->hWin, NewSel);
      27. }
      28. }
      29. break;
      30. default:
      31. DROPDOWN_Callback(pMsg);
      32. break;
      33. }
      34. }
      Display All

      Regards,
      Sven
      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.