Drop Down List with rollover

Good morning.

I’m in a scenario where I have only 2 buttons and using it as encoder. So I substantially have the Down Key and Enter Key.

For DDL, it would be useful to have a rollover function when browsing the list, something like this:

...

    else if(code == LV_EVENT_KEY) {
        char c = *((char *)lv_event_get_param(e));
        if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
            if(dropdown->list == NULL) {
                lv_dropdown_open(obj);
            }
            else if(dropdown->sel_opt_id + 1 < dropdown->option_cnt) {
                dropdown->sel_opt_id++;
                position_to_selected(obj);
            }
			//ROLLOVER
			else if(dropdown->sel_opt_id + 1 == dropdown->option_cnt) {
                dropdown->sel_opt_id = 0;
                position_to_selected(obj);
            }			
			//ROLLOVER
        }
...

It may be enabled/disabled via a set function, also.

What do you think?

Thanks,
Marco

Hi,

It makes sense! A Pull request would be very welcome :slight_smile: