application/main.c

changeset 1256
da0899b1699d
parent 1251
a1623c48c998
--- a/application/main.c	Sun Sep 13 11:50:14 2026 +0200
+++ b/application/main.c	Sun Sep 13 14:30:34 2026 +0200
@@ -759,6 +759,10 @@
     printf("content toggled: %d : %d\n", i, event->intval);
 }
 
+static void sourcelist_contextmenu_popup(UiEvent *event, void *userdata) {
+    printf("contextmenu popup at item: %d\n", event->intval);
+}
+
 void application_startup(UiEvent *event, void *data) {
     // test window destruction
     UiObject *testobj = ui_window("testwindow");
@@ -985,7 +989,7 @@
             //UiModel *model = ui_model(obj->ctx, UI_STRING, "test", -1);
             //ui_treeview(obj, .fill = TRUE, .model = model, .show_header = TRUE, .getvalue = tree_getvalue, .getdepth = tree_getdepth, .varname = "tree");
             
-            ui_sourcelist2(obj, .fill = TRUE, .getvalue = sourcelist2_getvalue, .varname = "tree", .onactivate = sourcelist2_activate);
+            ui_sourcelist2(obj, .fill = TRUE, .getvalue = sourcelist2_getvalue, .varname = "tree", .onactivate = sourcelist2_activate, .contextmenu = sourcelist_menu, .oncontextmenupopup = sourcelist_contextmenu_popup);
         }
     }
     

mercurial