Dropdown widget problem

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

    • Dropdown widget problem

      I am using a simple dropdown widget. Problem is the widget expands only at the first touch on the screen. After that it never closes, even if the rest of the widgets present in the window still work.

      Also, once expanded, the elements in the dropdown list cannot be selected.. I don't see why this is not working.
      Any idea why this happens?
      thanks
    • Hi,

      I can't say what is causing this behavior.

      Is the touch implemented correctly?
      Make sure that you pass an up event with the same coordinates as the last down event to emWin. Otherwise it can lead to strange behavior regarding the touch input.

      Can you post a simple application which shows how to reproduce it?

      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.
    • Thanks for your answer. This is the code that I have implemented for the touch screen.

      Main:


      /* Enable I-Cache-------------------------------------------------------------*/
      SCB_EnableICache();
      /* Enable D-Cache-------------------------------------------------------------*/
      SCB_EnableDCache();

      HAL_Init();
      SystemClock_Config();

      MX_GPIO_Init();
      MX_TIM6_Init();
      MX_LTDC_Init();

      BSP_TS_Init(800, 480); //initialize touch panel
      BSP_SDRAM_Init(); /* Initializes the SDRAM device */
      __HAL_RCC_CRC_CLK_ENABLE();
      GUI_Init();
      GUI_Clear();
      GUI_SetLayerVisEx(1, 0);
      GUI_SelectLayer(0);

      WM_MULTIBUF_Enable(1);

      Create_BUTTONS_Window(&hButt_1, &hButt_2); //window with buttons and other widgets

      HAL_TIM_Base_Init(&htim6); // timer interrupt for the touch screen
      HAL_TIM_Base_Start_IT(&htim6);

      while(1);


      The Timer Interrupt is like this:


      HAL_TIM_IRQHandler(&htim6);

      WM_Exec();

      BSP_TS_GetState(&ts);
      if (ts.touchDetected)
      {
      TS_State.Pressed = ts.touchDetected;
      TS_State.y = ts.touchY[0];
      TS_State.x = ts.touchX[0];
      GUI_PID_StoreState(&TS_State);
      }

      Can you tell if something is wrong? Keep in mind that other widgets work (as the buttons or the listviews; I have problems with checklist and dropdown lists).
      Thanks
    • Hi,

      Instead of a simply while(1) in your main application you should change it to this:

      C Source Code

      1. while(1) {
      2. GUI_Exec();
      3. }


      This will make sure that the window manager stays alive. Also, you should remove the WM_Exec() from your interrupt routine.

      Further there is no up event passed to emWin. Try this as your timer interrupt routine:

      C Source Code

      1. static void _GetTouch(void) {
      2. ts_type ts;
      3. static int Pressed;
      4. static GUI_PID_STATE TS_State;
      5. BSP_TS_GetState(&ts);
      6. if (ts.touchDetected) {
      7. TS_State.Pressed = ts.touchDetected;
      8. TS_State.y = ts.touchY[0];
      9. TS_State.x = ts.touchX[0];
      10. GUI_PID_StoreState(&TS_State);
      11. Pressed = 1;
      12. } else if (Pressed) {
      13. Pressed = 0;
      14. TS_State.Pressed = 0;
      15. GUI_PID_StoreState(&TS_State);
      16. }
      17. }
      Display All


      It is pretty important to use the same coordinates for the up event as for the last down event. That is why GUI_PID_STATE is declared as static. The 'Pressed' variable is used to detect an up event.

      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.