application/main.c

branch
newapi
changeset 344
870dd3d41d83
parent 343
54f5d7eb1335
child 345
d2ccc543f432
--- a/application/main.c	Tue Oct 22 21:17:01 2024 +0200
+++ b/application/main.c	Wed Oct 23 14:52:18 2024 +0200
@@ -79,6 +79,22 @@
     ui_dialog(event->obj, .title = "Dialog Title", .content = "Content Label", .button1_label = "btn1", .button2_label = "btn2", .input = TRUE, .closebutton_label = "Cancel");
 }
 
+void action_dialog_button(UiEvent *event, void *userdata) {
+    ui_close(event->obj);
+}
+
+void action_toolbar_dialog(UiEvent *event, void *userdata) {
+    
+    UiObject *dialog = ui_dialog_window(event->obj, .title  = "Dialog Window", .lbutton1 = "Cancel 1", .lbutton2 = "Btn2", .rbutton3 = "Btn3", .rbutton4 = "Login 4", .onclick = action_dialog_button, .show_closebutton = UI_OFF);
+    
+    ui_vbox(dialog, .margin = 10, .spacing = 10) {
+        ui_label(dialog, .label = "Enter password:");
+        ui_passwordfield(dialog, .varname = "password");
+    }
+    
+    ui_show(dialog);
+}
+
 void action_toolbar_newwindow(UiEvent *event, void *userdata) {
     UiObject *obj = ui_simple_window("New Window", NULL);
     
@@ -236,7 +252,12 @@
             }
         }
         ui_tab(obj, "Tab 2") {
-            ui_button(obj, .label = "Button", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 1", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 2", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 3", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 4", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 5", .onclick=action_tab2_button);
+            ui_button(obj, .label = "Button 6", .onclick=action_tab2_button);
         }
         ui_tab(obj, "Tab 3") {
             UiTabViewArgs args = {0};
@@ -276,7 +297,7 @@
     
     ui_toolbar_item("Test", .label = "Test", .onclick = action_toolbar_button);
     ui_toolbar_item("Test2", .label = "New Window", .onclick = action_toolbar_newwindow);
-    ui_toolbar_item("Test3", .label = "Test 3", .onclick = action_toolbar_button);
+    ui_toolbar_item("Test3", .label = "Dialog", .onclick = action_toolbar_dialog);
     ui_toolbar_item("Test4", .label = "Test 4", .onclick = action_toolbar_button);
     ui_toolbar_item("Test5", .label = "Test 5", .onclick = action_toolbar_button);
     ui_toolbar_item("Test6", .label = "Test 6", .onclick = action_toolbar_button);

mercurial