I have an (obscure?) use case in which I need to cancel the opening of a drop down list but at the same time react to a click/press event.
Here is the use case:
The user want to select a wifi network to connect to:
- The user click on a wifi AP dropdown list to select an item
- The list stays closed but a spinner is shown on top of it.
- The program starts a process that will gather the available wifi APs
- When this process returns with a list of APs:
4.1 , the spinner is deleted
4.2 the dropdown list is filled with the AP list
4.3 the list is opened so the user can select an AP.
What I tried so far:
- Call lv_async_call(close_list,list) in the list’s press event and in the close_list() function I call lv_dropdown_close() This didn’t work at all, the list stays open
- Start a timer in the lists pressed event to call the lv_dropdown_close()
The problem with this is that the list is closed only if then timer is more then 1000 , and by then the list was already opened for one second. - Add the LV_OBJ_FLAG_HIDDEN to the list in press event. The list box gets hidden but the open list stays open.
- send a PRESS event in the PRESS event to simulate a second click by the user to close the list but again the list stays opened (I used a busy flag to prevent endless PRESS events).
Possible solution:
To add a return value to event handlers that will determine if the default actions should be executed(if true)