75 } |
77 } |
76 |
78 |
77 void action_button(UiEvent *event, void *data) { |
79 void action_button(UiEvent *event, void *data) { |
78 printf("button: %d\n", event->intval); |
80 printf("button: %d\n", event->intval); |
79 //char *s = ui_gettext(event->obj, "text"); |
81 //char *s = ui_gettext(event->obj, "text"); |
80 //printf("{%s}\n", s); |
82 char *s = ui_getval(text); |
|
83 printf("{%s}\n", s); |
81 } |
84 } |
82 |
85 |
83 int main(int argc, char** argv) { |
86 int main(int argc, char** argv) { |
84 ui_init("app1", argc, argv); |
87 ui_init("app1", argc, argv); |
85 ui_locales_dir("/opt/app1/locales"); |
88 ui_locales_dir("/opt/app1/locales"); |
92 //ui_menuitem("Close", action_close, NULL); |
95 //ui_menuitem("Close", action_close, NULL); |
93 ui_menuitem_st(UI_STOCK_NEW, action_new, NULL); |
96 ui_menuitem_st(UI_STOCK_NEW, action_new, NULL); |
94 ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL); |
97 ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL); |
95 //ui_checkitem("Check", action_button, NULL); |
98 //ui_checkitem("Check", action_button, NULL); |
96 |
99 |
97 ui_toolitem_st("button", UI_STOCK_GO_BACK, action_button, NULL); |
100 ui_toolitem_st("button", UI_STOCK_OPEN, action_button, NULL); |
98 ui_toolbar_add_default("button"); |
101 ui_toolbar_add_default("button"); |
99 |
102 |
100 printf("create window\n"); |
103 printf("create window\n"); |
101 UiObject *window = ui_window("Mod0", NULL); |
104 UiObject *window = ui_window("Mod0", NULL); |
|
105 ui_textarea(window, &text); |
102 |
106 |
103 /* |
107 /* |
104 UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1); |
108 UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1); |
105 model->getvalue = (ui_model_getvalue_f)person_getvalue; |
109 model->getvalue = (ui_model_getvalue_f)person_getvalue; |
106 model->activate = action_activate; |
110 model->activate = action_activate; |