make/vs/testapp/main.c

branch
newapi
changeset 188
fbbae6738252
parent 187
24ce2c326d85
child 189
4daddc326877
--- a/make/vs/testapp/main.c	Sun Oct 01 12:08:09 2023 +0200
+++ b/make/vs/testapp/main.c	Sun Oct 01 14:40:43 2023 +0200
@@ -37,6 +37,7 @@
 typedef struct WindowData {
     UiInteger* check;
     UiInteger* toggle;
+    UiInteger* radio;
 } WindowData;
 
 void action1(UiEvent* event, void* data) {
@@ -44,6 +45,7 @@
     
     WindowData* wdata = event->window;
     int64_t is_checked = wdata->check->get(wdata->check);
+    int64_t radio = wdata->radio->get(wdata->radio);
 
     printf("data: %s %d\n", data, is_checked);
 }
@@ -61,6 +63,7 @@
     obj->window = wdata;
     wdata->check = ui_int_new(obj->ctx, "check");
     wdata->toggle = ui_int_new(obj->ctx, "toggle");
+    wdata->radio = ui_int_new(obj->ctx, "radio");
 
     UI_GRID_SP(obj, 10, 5, 20) {
         ui_button(obj, .label="Button1", .onclick=action1, .onclickdata="action1");
@@ -77,6 +80,15 @@
 
         ui_checkbox(obj, .label = "Option 1", .value = wdata->check);
         ui_togglebutton(obj, .label = "Option 2", .value = wdata->toggle);
+        ui_newline(obj);
+
+        ui_layout_colspan(obj, 3);
+        ui_layout_fill(obj, FALSE);
+        UI_HBOX(obj) {
+            ui_radiobutton(obj, .label = "Radio 1", .value = wdata->radio);
+            ui_radiobutton(obj, .label = "Radio 2", .value = wdata->radio);
+            ui_radiobutton(obj, .label = "Radio 3", .value = wdata->radio);
+        }
     }
 
     ui_show(obj);

mercurial