diff --git a/src/widgets/combo_box.c b/src/widgets/combo_box.c index bcc289177..85b1e0d6d 100644 --- a/src/widgets/combo_box.c +++ b/src/widgets/combo_box.c @@ -289,11 +289,31 @@ static ret_t combo_box_on_event(widget_t* widget, event_t* e) { } break; } + case EVT_POINTER_DOWN: { + combo_box->pressed = TRUE; + break; + } + case EVT_POINTER_DOWN_ABORT: { + combo_box->pressed = FALSE; + break; + } + case EVT_POINTER_UP: { + if (widget->target == NULL && edit->readonly && combo_box->pressed) { + combo_box_active(widget); + return RET_STOP; + } + combo_box->pressed = FALSE; + } + default: break; } + ret = edit_on_event(widget, e); - edit_set_cursor(WIDGET(edit), 0); + if(edit->readonly) { + edit_set_cursor(WIDGET(edit), 0); + } + return ret; } diff --git a/src/widgets/combo_box.h b/src/widgets/combo_box.h index 62e5f888b..369c0e420 100644 --- a/src/widgets/combo_box.h +++ b/src/widgets/combo_box.h @@ -197,6 +197,7 @@ typedef struct _combo_box_t { /*private*/ str_t text; + bool_t pressed; combo_box_option_t* option_items; combo_box_custom_open_popup_t open_popup; } combo_box_t;