Extarcting sring from a dropdown doesnt work like it should

What do you want to achieve?

i would like to be able extract a string form a dropdown list from first click.

What have you tried so far?

I have successfully extracted a string from a dropdown list, my problem is that i have to click the widget again for the extraction to work.

This is the function i wrote to handle the dropdown list event:

static void event_cb(lv_event_t * e)
    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t *obj = lv_event_get_target(e);
    char buf[64];
    if (code == LV_EVENT_RELEASED){
    //lv_obj_clear_flag(ui_Keyboard2, LV_OBJ_FLAG_HIDDEN);
     //lv_obj_clear_flag(ui_Panel1, LV_OBJ_FLAG_HIDDEN);
    lv_dropdown_get_selected_str(ui_TESTDROP, buf, sizeof(buf));
     String selectedItem =String (buf);
    for (int i = 0; i < selectedItem.length() - 1; i++) {
      if (selectedItem.substring(i, i + 2) != " (") {
        ssidName = dd;
       lv_label_set_text_fmt(ui_Label5, "%s", ssidName);

and another bug that i couldn’t solve was why does the function automatically extracts he first option on the list, is there a possible solution for this??


  • **SquareLine Studio version: 1.4.0
  • Operating system:
  • Target hardware:

I think you should simply use the VALUE_CHANGED trigger instead of the RELEASED.
(And to init the dropdown-widget with a specific index, not always the first, you can use lv_dropdown_set_selected(dropdown_widget,index) in the SCREEN_LOADED event when opening its screen.)