--- a/application/main.c Sun Oct 13 19:41:12 2024 +0200 +++ b/application/main.c Sun Oct 13 21:28:09 2024 +0200 @@ -43,6 +43,7 @@ UiList *menulist; UiInteger *radio; UiInteger *tabview; + UiGeneric *image; } MyDocument; MyDocument *doc1; @@ -56,14 +57,16 @@ void action_file_selected(UiEvent *event, void *userdata) { UiFileList *files = event->eventdata; + MyDocument *doc = event->document; printf("files: %d\n", (int)files->nfiles); if(files->nfiles > 0) { printf("selected file: %s\n", files->files[0]); + ui_image_load_file(doc->image, files->files[0]); } } void action_button(UiEvent *event, void *userdata) { - ui_savefiledialog(event->obj, "myfile.txt", action_file_selected, NULL); + ui_openfiledialog(event->obj, UI_FILEDIALOG_SELECT_SINGLE, action_file_selected, NULL); } void action_switch(UiEvent *event, void *userdata) { @@ -106,6 +109,7 @@ ui_list_append(doc->list, "test3"); doc->radio = ui_int_new(docctx, "radio"); doc->tabview = ui_int_new(docctx, "tabview"); + doc->image = ui_generic_new(docctx, "image"); //doc->text = ui_text_new(docctx, "text"); return doc; } @@ -225,6 +229,10 @@ ui_tab(obj, "Tab 4") { ui_textarea(obj, .varname = "text"); } + ui_tab(obj, "Tab 5") { + ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); + ui_imageviewer(obj, .varname = "image"); + } } /*