application/main.c

branch
newapi
changeset 390
b130f80ec7f9
parent 389
d15eca5fd8b3
child 402
96a055be7f0b
--- a/application/main.c	Thu Nov 21 13:17:56 2024 +0100
+++ b/application/main.c	Thu Nov 21 18:45:47 2024 +0100
@@ -40,6 +40,7 @@
     UiText *text;
     UiDouble *progress;
     UiList *list;
+    UiList *list2;
     UiList *menulist;
     UiInteger *radio;
     UiInteger *tabview;
@@ -152,6 +153,10 @@
     ui_list_append(doc->list, "test1");
     ui_list_append(doc->list, "test2");
     ui_list_append(doc->list, "test3");
+    doc->list2 = ui_list_new(docctx, "list2");
+    ui_list_append(doc->list2, "test1");
+    ui_list_append(doc->list2, "test2");
+    ui_list_append(doc->list2, "test3");
     doc->radio = ui_int_new(docctx, "radio");
     doc->tabview = ui_int_new(docctx, "tabview");
     doc->image = ui_generic_new(docctx, "image");
@@ -241,6 +246,10 @@
 
 UiMenuBuilder *menubuilder;
 
+void* table_getvalue(void *row, int col) {
+    return row;
+}
+
 void application_startup(UiEvent *event, void *data) {
     // global list
     UiContext *global = ui_global_context();
@@ -303,6 +312,11 @@
                     ui_radiobutton(obj, .label = "Radio 2", .varname = "radio");
                     ui_radiobutton(obj, .label = "Radio 3", .varname = "radio");
                 }
+                ui_newline(obj);
+                
+                UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", -1);
+                model->getvalue = table_getvalue;
+                ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .hexpand = TRUE, .contextmenu = menubuilder);
             }
         }
         ui_tab(obj, "Tab 2") {

mercurial