--- a/ui/common/types.c Sun Jan 25 11:24:02 2026 +0100 +++ b/ui/common/types.c Sun Jan 25 11:44:49 2026 +0100 @@ -810,13 +810,22 @@ } UIEXPORT void ui_list_setselection(UiList *list, int index) { + ui_list_setselection2(list, index, TRUE); +} + +UIEXPORT void ui_list_setselection2(UiList *list, int index, UiBool selection_event) { if (list->setselection) { UiListSelection sel = { 0, NULL }; if(index >= 0) { sel.count = 1; sel.rows = &index; } + UiBool events = ui_selection_events_is_enabled(); + if(!selection_event) { + ui_selection_events_enable(FALSE); + } list->setselection(list, sel); + ui_selection_events_enable(events); } } @@ -883,6 +892,7 @@ static int ui_set_op = 0; static int ui_onchange_events_enabled = TRUE; +static int ui_selection_events_enabled = TRUE; void ui_setop_enable(int set) { ui_set_op = set; @@ -900,6 +910,14 @@ return ui_onchange_events_enabled; } +void ui_selection_events_enable(UiBool enable) { + ui_selection_events_enabled = enable; +} + +UiBool ui_selection_events_is_enabled(void) { + return ui_selection_events_enabled; +} + /* ---------------- List initializers and wrapper functions ---------------- */ void ui_global_list_initializer(ui_list_init_func func, void *userdata) {