I'm making an application on gtk4 and I have a need to display a table with 5 columns. I realized that now the best widget for this would be columnview, I found a small working example but only for outputting directory files and could only figure out half of it. Can anyone show a working example of a widget that accepts strings in C?
In the example, I tried to change the accepted type of the g_list_store_new function from G_TYPE_FILE_INFO to G_TYPE_STRING. But when starting the program, it gave an error.
Compilation : gcc -o a e.c $(pkg-config --cflags --libs gtk4)
File example link: github repository
Views (such as GTKColumnView) display data from a model. In GTK4, there are generic list model implementations, such as GListStore, that allow you to create lists of arbitrary objects. To add multiple columns to a GListStore, you'll need to create a custom type that contains the data for each column. This type must be derived from GObject and have the appropriate properties for each column. You can then use the g_list_store_new() function to create a new GListStore with this type as a item_type. You'll also need one factory per column. Everything else can be found in the following listing.