application/main.c

changeset 827
eae5b817aa47
parent 825
1bac7e45712b
child 841
651cf2c59dd9
--- a/application/main.c	Fri Oct 10 09:05:11 2025 +0200
+++ b/application/main.c	Fri Oct 10 09:06:06 2025 +0200
@@ -470,6 +470,7 @@
         case 6: return (void*)(intptr_t)123;
         case 7: return "edit me";
         case 8: return "edit me too";
+        case 9: return (void*)(intptr_t)1;
     }
     return NULL;
 }
@@ -672,7 +673,7 @@
             }
         }
         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", -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);
             model->columnsize[0] = -1;
             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,
@@ -1075,6 +1076,17 @@
             ui_radiobutton(obj, .label = "Radio 3", .varname = "radio");
             ui_radiobutton(obj, .label = "Radio 4", .varname = "radio");
         }
+        ui_newline(obj);
+        
+        ui_hbox(obj, .colspan = 3) {
+            ui_button(obj, .label = "Margin Test 1", .margin_top = 10);
+            ui_button(obj, .label = "Margin Test 2", .margin_top = 20);
+            UIWIDGET w = ui_button(obj, .label = "Margin Test 3", .margin = 30);
+            //ui_set_visible(w, FALSE);
+            ui_button(obj, .label = "Margin Test 4", .margin_top = 40);
+            ui_button(obj, .label = "Margin Test 5", .margin_top = 50);
+            ui_button(obj, .label = "Margin Test 6", .margin_top = 60);
+        }
     }
     ui_show(obj);
 }
@@ -1123,9 +1135,18 @@
 
 #ifdef UI_WIN32
 
+static void action_button(UiEvent *event, void *data) {
+    printf("button clicked\n");
+}
+
 void application_startup(UiEvent *event, void *data) {
 	UiObject *obj = ui_window("Test w32", NULL);
-	
+    ui_button(obj, .label = "Test", .hfill = TRUE, .hexpand = TRUE, .colspan = 3, .margin = 10);
+    ui_button(obj, .label = "Test 2-1", .margin_left = 10);
+    ui_button(obj, .label = "Test 2-2", .hfill = TRUE, .hexpand = TRUE, .margin_left = 20);
+    ui_button(obj, .label = "Test 2-3", .margin_left = 30);
+    ui_button(obj, .label = "Test 3XX", .colspan = 3, .fill = TRUE, .onclick = action_button);
+	ui_show(obj);
 }
 
 int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {

mercurial