--- a/ui/winui/list.cpp Thu Oct 19 18:30:19 2023 +0200 +++ b/ui/winui/list.cpp Thu Oct 19 20:38:16 2023 +0200 @@ -283,6 +283,7 @@ uipathbar->grid = content; uipathbar->buttons = buttons; uipathbar->textbox = pathTextBox; + uipathbar->obj = obj; uipathbar->enabledrag = args.enabledrag; uipathbar->enabledrop = args.enabledrop; uipathbar->getvalue = args.getvalue; @@ -415,6 +416,7 @@ // add new buttons void* elm = list->first(list); + int j = 0; while (elm) { char* value = (char*)getvalue(elm, 0); wchar_t* wstr = str2wstr(value, nullptr); @@ -422,6 +424,18 @@ button.Content(box_value(wstr)); free(wstr); + if (pb->onactivate) { + button.Click([pb, j](IInspectable const& sender, RoutedEventArgs) { + UiEvent evt; + evt.obj = pb->obj; + evt.window = evt.obj->window; + evt.document = evt.obj->ctx->document; + evt.eventdata = nullptr; + evt.intval = j; + pb->onactivate(&evt, pb->onactivatedata); + }); + } + Thickness t = { 0, 0, 1, 0 }; CornerRadius c = { 0 ,0, 0, 0 }; button.BorderThickness(t); @@ -429,6 +443,7 @@ pb->buttons.Children().Append(button); + j++; elm = list->next(list); } }