application/main.c

changeset 778
85b6cef7fcba
parent 777
622efebfab37
child 779
b84cbe57e0bd
equal deleted inserted replaced
777:622efebfab37 778:85b6cef7fcba
568 char *label = ui_get(doc->link_label); 568 char *label = ui_get(doc->link_label);
569 char *uri = ui_get(doc->link_uri); 569 char *uri = ui_get(doc->link_uri);
570 ui_linkbutton_value_set(doc->link, label, uri); 570 ui_linkbutton_value_set(doc->link, label, uri);
571 } 571 }
572 572
573 static UiBool list_save(UiList *list, int row, int col, UiCellValue value, void *userdata) {
574 printf("list new value at [%d, %d]: %s\n", row, col, value.string);
575 return FALSE;
576 }
577
573 void application_startup(UiEvent *event, void *data) { 578 void application_startup(UiEvent *event, void *data) {
574 // global list 579 // global list
575 UiContext *global = ui_global_context(); 580 UiContext *global = ui_global_context();
576 menu_list = ui_list_new(global, "menulist"); 581 menu_list = ui_list_new(global, "menulist");
577 ui_list_append(menu_list, "menu list item 1"); 582 ui_list_append(menu_list, "menu list item 1");
656 } 661 }
657 ui_tab(obj, "Tab 1") { 662 ui_tab(obj, "Tab 1") {
658 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); 663 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);
659 model->columnsize[0] = -1; 664 model->columnsize[0] = -1;
660 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, 665 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE,
661 .getvalue = table_getvalue, .getstyle = table_getstyle, 666 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save,
662 .onactivate = action_table_activate, .onactivatedata = "activate", 667 .onactivate = action_table_activate, .onactivatedata = "activate",
663 .onselection = action_table_activate, .onselectiondata = "selection"); 668 .onselection = action_table_activate, .onselectiondata = "selection");
664 ui_hbox(obj, .fill = FALSE) { 669 ui_hbox(obj, .fill = FALSE) {
665 ui_textfield(obj, .value = doc->list_input); 670 ui_textfield(obj, .value = doc->list_input);
666 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); 671 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list);

mercurial