fix list binding copy newapi

Mon, 29 Jan 2024 18:47:55 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 29 Jan 2024 18:47:55 +0100
branch
newapi
changeset 239
5dd24929f9f6
parent 238
56621137b8e1
child 240
9335e9bbc167

fix list binding copy

ui/common/context.c file | annotate | diff | comparison | revisions
ui/winui/text.cpp file | annotate | diff | comparison | revisions
--- a/ui/common/context.c	Mon Jan 29 14:02:00 2024 +0100
+++ b/ui/common/context.c	Mon Jan 29 18:47:55 2024 +0100
@@ -316,12 +316,19 @@
         case UI_VAR_LIST: {
             // TODO: not sure how correct this is
 
+            UiList *f = from->value;
+            UiList *t = to->value;
+            if (f->obj) {
+                t->obj = f->obj;
+                t->update = f->update;
+            }
+
             UiVar tmp = *from;
             *from = *to;
             *to = tmp;
 
-            UiList* t = to->value;
-            ui_notify(t->observers, NULL);
+            UiList* t2 = to->value;
+            ui_notify(t2->observers, NULL);
             
             break;
         }
--- a/ui/winui/text.cpp	Mon Jan 29 14:02:00 2024 +0100
+++ b/ui/winui/text.cpp	Mon Jan 29 18:47:55 2024 +0100
@@ -452,7 +452,7 @@
     ui_context_add_widget_destructor(current->ctx, widget);
 
     // bind var
-    UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_LIST);
+    UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_STRING);
     if (var) {
         UiString* value = (UiString*)var->value;
         value->obj = uipathbar;

mercurial