| 334 |
335 |
| 335 doc->web = ui_generic_new(docctx, NULL); |
336 doc->web = ui_generic_new(docctx, NULL); |
| 336 |
337 |
| 337 doc->list_input = ui_string_new(docctx, "list_input"); |
338 doc->list_input = ui_string_new(docctx, "list_input"); |
| 338 |
339 |
| |
340 doc->list11 = ui_list_new(docctx, "list11"); |
| |
341 ui_list_append(doc->list11, "Item 1"); |
| |
342 ui_list_append(doc->list11, "Item 2"); |
| |
343 ui_list_append(doc->list11, "Item 3"); |
| |
344 |
| 339 //doc->text = ui_text_new(docctx, "text"); |
345 //doc->text = ui_text_new(docctx, "text"); |
| 340 return doc; |
346 return doc; |
| 341 } |
347 } |
| 342 |
348 |
| 343 UiIcon *icon = NULL; |
349 UiIcon *icon = NULL; |
| 501 CxList *list2 = doc->list2->data; |
507 CxList *list2 = doc->list2->data; |
| 502 cxListRemove(list2, 1); |
508 cxListRemove(list2, 1); |
| 503 cxListInsert(list2, 1, strdup(newvalue)); |
509 cxListInsert(list2, 1, strdup(newvalue)); |
| 504 |
510 |
| 505 doc->list2->update(doc->list2, 1); |
511 doc->list2->update(doc->list2, 1); |
| |
512 } |
| |
513 |
| |
514 static void action_list_selection(UiEvent *event, void *userdata) { |
| |
515 UiListSelection *sel = event->eventdata; |
| |
516 printf("list selection[%d]\n", sel->count); |
| |
517 for(int i=0;i<sel->count;i++) { |
| |
518 printf("[%d]: %d\n", i, sel->rows[i]); |
| |
519 } |
| |
520 printf("\n"); |
| |
521 } |
| |
522 |
| |
523 static void action_list_activate(UiEvent *event, void *userdata) { |
| |
524 printf("activate\n"); |
| |
525 action_list_selection(event, userdata); |
| 506 } |
526 } |
| 507 |
527 |
| 508 void application_startup(UiEvent *event, void *data) { |
528 void application_startup(UiEvent *event, void *data) { |
| 509 // global list |
529 // global list |
| 510 UiContext *global = ui_global_context(); |
530 UiContext *global = ui_global_context(); |
| 679 ui_label(obj, .label = "Manual vfill", .override_defaults = TRUE, .vfill = TRUE); |
699 ui_label(obj, .label = "Manual vfill", .override_defaults = TRUE, .vfill = TRUE); |
| 680 ui_textfield(obj, .hexpand = TRUE); |
700 ui_textfield(obj, .hexpand = TRUE); |
| 681 ui_newline(obj); |
701 ui_newline(obj); |
| 682 } |
702 } |
| 683 } |
703 } |
| |
704 ui_tab(obj, "Tab 11") { |
| |
705 ui_grid(obj, .margin = 10, .rowspacing = 10, .columnspacing = 10, .fill = TRUE) { |
| |
706 ui_listview(obj, .varname = "list11", .multiselection = FALSE, .onselection = action_list_selection, .onactivate = action_list_activate, .hexpand = TRUE, .hfill = TRUE, .vexpand = TRUE, .vfill = TRUE); |
| |
707 } |
| |
708 } |
| 684 } |
709 } |
| 685 |
710 |
| 686 /* |
711 /* |
| 687 |
712 |
| 688 */ |
713 */ |