application/main.c

changeset 70
3d801e8dda3a
parent 69
419c8c3209e8
child 71
3e021c5f18a0
--- a/application/main.c	Sat Jan 10 10:14:28 2015 +0100
+++ b/application/main.c	Sun Jan 11 15:29:38 2015 +0100
@@ -76,7 +76,8 @@
 
 void action_button(UiEvent *event, void *data) {
     printf("button: %d\n", event->intval);
-    char *s = ui_gettext(event->obj, "text");
+    //char *s = ui_gettext(event->obj, "text");
+    char *s = ui_getval(name);
     printf("{%s}\n", s);
     //printf("name: {%s}\n", ui_getval(name));
     //printf("mail: {%s}\n", ui_getval(mail));
@@ -105,29 +106,17 @@
     printf("create window\n");
     UiObject *window = ui_window("Mod0", NULL);
     
-    UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1);
-    model->getvalue = (ui_model_getvalue_f)person_getvalue;
-    model->activate = action_activate;
-    model->selection = action_select;
-    UiList *list = ui_list_new();
-    Person *p1 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p2 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p3 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p4 = ui_malloc(window->ctx, sizeof(Person));
-    p1->name = "Some Näme";
-    p1->mail = "mail@host.com";
-    p2->name = "押井守";
-    p2->mail = "other.person@provider.com";
-    p3->name = "My Self";
-    p3->mail = "my@self.org";
-    p4->name = "Gregory House";
-    p4->mail = "greg@pp";
-    ui_list_append(list, p1);
-    ui_list_append(list, p2);
-    ui_list_append(list, p3);
-    ui_list_append(list, p4);
+    ui_grid(window);
+    
+    ui_label(window, "Name");
+    ui_textfield(window, &name);
+    ui_newline(window);
     
-    ui_table(window, list, model);
+    ui_label(window, "Email");
+    ui_textfield(window, &mail);
+    
+    
+    ui_end(window);
     
     
     ui_show(window);

mercurial