--- a/application/main.c Sun Dec 07 12:24:12 2025 +0100 +++ b/application/main.c Sun Dec 07 14:39:03 2025 +0100 @@ -197,11 +197,14 @@ UiList *items; UiGeneric *web; UiString *list_input; + UiString *list_new_col; UiList *list11; UiString *link; UiString *link_label; UiString *link_uri; UiList *submenulist; + + UiModel *model; } MyDocument; MyDocument *doc1; @@ -349,6 +352,7 @@ doc->web = ui_generic_new(docctx, NULL); doc->list_input = ui_string_new(docctx, "list_input"); + doc->list_new_col = ui_string_new(docctx, NULL); doc->list11 = ui_list_new(docctx, "list11"); ui_list_append(doc->list11, "Item 1"); @@ -471,6 +475,7 @@ UiMenuBuilder *sourcelist_menu; void* table_getvalue(void *row, int col) { + return "test"; switch(col) { case 0: return ui_foldericon(16); case 1: return row; @@ -568,6 +573,13 @@ doc->list2->update(doc->list2, 1); } +static void action_add_col(UiEvent *event, void *userdata) { + MyDocument *doc = event->document; + + char *colname = ui_get(doc->list_new_col); + ui_model_add_column(doc->model, UI_STRING, colname, 200); +} + static void action_list_selection(UiEvent *event, void *userdata) { UiListSelection *sel = event->eventdata; printf("list selection[%d]\n", sel->count); @@ -695,15 +707,20 @@ } } ui_tab(obj, "Tab 1") { - UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", UI_STRING_EDITABLE, "edit6", UI_STRING_EDITABLE, "edit7", UI_BOOL_EDITABLE, "Check", -1); + //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", UI_STRING_EDITABLE, "edit6", UI_STRING_EDITABLE, "edit7", UI_BOOL_EDITABLE, "Check", -1); + UiModel *model = ui_model(obj->ctx, UI_STRING, "Col", -1); model->columnsize[0] = -1; + doc->model = model; ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, .onactivate = action_table_activate, .onactivatedata = "activate", .onselection = action_table_activate, .onselectiondata = "selection"); - ui_hbox(obj, .fill = FALSE) { + ui_hbox(obj, .fill = FALSE, .columnspacing = 4) { ui_textfield(obj, .value = doc->list_input); ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); + ui_label(obj, .label = "Column Name"); + ui_textfield(obj, .value = doc->list_new_col); + ui_button(obj, .label = "Add Column", .onclick = action_add_col); } } ui_tab(obj, "Tab 2") {