| 347 ui_list_append(doc->items, "Item 3"); |
350 ui_list_append(doc->items, "Item 3"); |
| 348 |
351 |
| 349 doc->web = ui_generic_new(docctx, NULL); |
352 doc->web = ui_generic_new(docctx, NULL); |
| 350 |
353 |
| 351 doc->list_input = ui_string_new(docctx, "list_input"); |
354 doc->list_input = ui_string_new(docctx, "list_input"); |
| |
355 doc->list_new_col = ui_string_new(docctx, NULL); |
| 352 |
356 |
| 353 doc->list11 = ui_list_new(docctx, "list11"); |
357 doc->list11 = ui_list_new(docctx, "list11"); |
| 354 ui_list_append(doc->list11, "Item 1"); |
358 ui_list_append(doc->list11, "Item 1"); |
| 355 ui_list_append(doc->list11, "Item 2"); |
359 ui_list_append(doc->list11, "Item 2"); |
| 356 ui_list_append(doc->list11, "Item 3"); |
360 ui_list_append(doc->list11, "Item 3"); |
| 566 cxListInsert(list2, 1, strdup(newvalue)); |
571 cxListInsert(list2, 1, strdup(newvalue)); |
| 567 |
572 |
| 568 doc->list2->update(doc->list2, 1); |
573 doc->list2->update(doc->list2, 1); |
| 569 } |
574 } |
| 570 |
575 |
| |
576 static void action_add_col(UiEvent *event, void *userdata) { |
| |
577 MyDocument *doc = event->document; |
| |
578 |
| |
579 char *colname = ui_get(doc->list_new_col); |
| |
580 ui_model_add_column(doc->model, UI_STRING, colname, 200); |
| |
581 } |
| |
582 |
| 571 static void action_list_selection(UiEvent *event, void *userdata) { |
583 static void action_list_selection(UiEvent *event, void *userdata) { |
| 572 UiListSelection *sel = event->eventdata; |
584 UiListSelection *sel = event->eventdata; |
| 573 printf("list selection[%d]\n", sel->count); |
585 printf("list selection[%d]\n", sel->count); |
| 574 for(int i=0;i<sel->count;i++) { |
586 for(int i=0;i<sel->count;i++) { |
| 575 printf("[%d]: %d\n", i, sel->rows[i]); |
587 printf("[%d]: %d\n", i, sel->rows[i]); |
| 693 } |
705 } |
| 694 ui_newline(obj); |
706 ui_newline(obj); |
| 695 } |
707 } |
| 696 } |
708 } |
| 697 ui_tab(obj, "Tab 1") { |
709 ui_tab(obj, "Tab 1") { |
| 698 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", UI_BOOL_EDITABLE, "Check", -1); |
710 //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", UI_BOOL_EDITABLE, "Check", -1); |
| |
711 UiModel *model = ui_model(obj->ctx, UI_STRING, "Col", -1); |
| 699 model->columnsize[0] = -1; |
712 model->columnsize[0] = -1; |
| |
713 doc->model = model; |
| 700 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
714 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
| 701 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
715 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
| 702 .onactivate = action_table_activate, .onactivatedata = "activate", |
716 .onactivate = action_table_activate, .onactivatedata = "activate", |
| 703 .onselection = action_table_activate, .onselectiondata = "selection"); |
717 .onselection = action_table_activate, .onselectiondata = "selection"); |
| 704 ui_hbox(obj, .fill = FALSE) { |
718 ui_hbox(obj, .fill = FALSE, .columnspacing = 4) { |
| 705 ui_textfield(obj, .value = doc->list_input); |
719 ui_textfield(obj, .value = doc->list_input); |
| 706 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); |
720 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); |
| |
721 ui_label(obj, .label = "Column Name"); |
| |
722 ui_textfield(obj, .value = doc->list_new_col); |
| |
723 ui_button(obj, .label = "Add Column", .onclick = action_add_col); |
| 707 } |
724 } |
| 708 } |
725 } |
| 709 ui_tab(obj, "Tab 2") { |
726 ui_tab(obj, "Tab 2") { |
| 710 ui_button(obj, .label = "Button 1 Start Thread", .onclick=action_start_thread); |
727 ui_button(obj, .label = "Button 1 Start Thread", .onclick=action_start_thread); |
| 711 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); |
728 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); |