application/main.c

changeset 701
6fdec085c385
parent 673
90a32d739b8e
child 704
6105e9d9b7e1
equal deleted inserted replaced
700:7032f69a325c 701:6fdec085c385
196 UiList *srclist1; 196 UiList *srclist1;
197 UiList *srclist2; 197 UiList *srclist2;
198 UiList *items; 198 UiList *items;
199 UiGeneric *web; 199 UiGeneric *web;
200 UiString *list_input; 200 UiString *list_input;
201 UiList *list11;
201 } MyDocument; 202 } MyDocument;
202 203
203 MyDocument *doc1; 204 MyDocument *doc1;
204 MyDocument *doc2; 205 MyDocument *doc2;
205 206
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 */

mercurial