Fri, 23 Jan 2026 16:13:42 +0100
implement hide_header arg (Win32)
| application/main.c | file | annotate | diff | comparison | revisions | |
| ui/win32/list.c | file | annotate | diff | comparison | revisions | |
| ui/win32/list.h | file | annotate | diff | comparison | revisions |
--- a/application/main.c Thu Jan 22 23:18:00 2026 +0100 +++ b/application/main.c Fri Jan 23 16:13:42 2026 +0100 @@ -1276,9 +1276,8 @@ ui_list_append(list, &person2); ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .fill = TRUE) { - //UiModel *model = ui_model(obj->ctx, UI_STRING, "Name", UI_STRING, "Email", -1); - //ui_table(obj, .fill = TRUE, .varname = "persons", .model = model, .getvalue = person_getvalue, .onselection = list_onselection); - //ui_model_free(obj->ctx, model); + UiModel *model = ui_model(obj->ctx, UI_STRING, "Name", UI_STRING, "Email", -1); + ui_table(obj, .fill = TRUE, .varname = "persons", .model = model, .getvalue = person_getvalue, .onselection = list_onselection); //ui_dropdown(obj, .varname = "persons", .getvalue = person_getvalue, .onactivate = list_onselection, .hexpand = TRUE, .hfill = TRUE); char *list[] = { "test 1",
--- a/ui/win32/list.c Thu Jan 22 23:18:00 2026 +0100 +++ b/ui/win32/list.c Fri Jan 23 16:13:42 2026 +0100 @@ -41,7 +41,7 @@ .enable = w32_widget_default_enable, .show = w32_widget_default_show, .get_preferred_size = ui_listview_get_preferred_size, - .destroy = w32_widget_default_destroy + .destroy = ui_listview_destroy }; static void* strmodel_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) { @@ -103,11 +103,15 @@ HWND parent = ui_container_get_parent(container); UiLayout layout = UI_ARGS2LAYOUT(args); + unsigned int noheader = 0; + if (!table || args->hide_header) { + noheader = LVS_NOCOLUMNHEADER; + } HWND hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_LISTVIEW, "", - WS_CHILD | WS_VISIBLE | LVS_REPORT, + WS_CHILD | WS_VISIBLE | LVS_REPORT | noheader, 0, 0, 100, 100, parent, (HMENU)1337, @@ -278,6 +282,14 @@ return size; } +void ui_listview_destroy(W32Widget *widget) { + UiListView *listview = (UiListView*)widget; + if (listview->model) { + ui_model_unref(listview->model); + } + free(widget); +} + /* * Creates and inserts an LVITEM *
--- a/ui/win32/list.h Thu Jan 22 23:18:00 2026 +0100 +++ b/ui/win32/list.h Fri Jan 23 16:13:42 2026 +0100 @@ -64,6 +64,7 @@ int ui_listview_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); W32Size ui_listview_get_preferred_size(W32Widget *widget); +void ui_listview_destroy(W32Widget *widget); void ui_listview_update(UiList *list, int row); UiListSelection ui_listview_getselection_impl(UiList *list);