# HG changeset patch # User Olaf Wintermann # Date 1708107892 -3600 # Node ID 37d5b49b1c9143df5e5035a0c51b5e2cad108926 # Parent 3756725aeaf4be156d3760a0137bd8b2bd09bce1 fix progressbar using the wrong var type (GTK) diff -r 3756725aeaf4 -r 37d5b49b1c91 application/main.c --- a/application/main.c Fri Feb 16 19:17:30 2024 +0100 +++ b/application/main.c Fri Feb 16 19:24:52 2024 +0100 @@ -36,6 +36,7 @@ typedef struct { UiString *str1; UiString *str2; + UiDouble *progress; } MyDocument; MyDocument *doc1; @@ -60,6 +61,7 @@ UiContext *docctx = ui_document_context(doc); doc->str1 = ui_string_new(docctx, "str1"); doc->str1 = ui_string_new(docctx, "str2"); + doc->progress = ui_double_new(docctx, "progress"); return doc; } @@ -67,11 +69,14 @@ UiObject *obj = ui_window("Test", NULL); + MyDocument *doc = create_doc(); + ui_attach_document(obj->ctx, doc); + ui_button(obj, .label = "Test Button", .icon = "application-x-generic"); ui_togglebutton(obj, .label = "Toggle"); ui_checkbox(obj, .label = "Checkbox"); - ui_grid(obj, .fill = 1) { + ui_grid(obj, .fill = 1, .spacing = 5) { ui_button(obj, .label = "cell1", .hexpand = TRUE); ui_button(obj, .label = "cell2"); ui_newline(obj); @@ -83,7 +88,10 @@ ui_newline(obj); ui_spinner(obj, .step = 5); + ui_newline(obj); + ui_progressbar(obj, .colspan = 2, .varname = "progress"); + ui_set(doc->progress, 0.75); } ui_show(obj); diff -r 3756725aeaf4 -r 37d5b49b1c91 ui/gtk/display.c --- a/ui/gtk/display.c Fri Feb 16 19:17:30 2024 +0100 +++ b/ui/gtk/display.c Fri Feb 16 19:24:52 2024 +0100 @@ -124,7 +124,7 @@ GtkWidget *progressbar = gtk_progress_bar_new(); - UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_STRING); + UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_DOUBLE); if(var && var->value) { UiDouble *value = var->value; value->get = ui_progressbar_get;