I'm having trouble wrapping GTKComboBox with lots of alphabetically sorted entries by column rather than row by row.
Please see the following minimum working example and the attached screenshot to understand what I'm trying to achieve. The focal point of my code is a function gtk_combo_box_set_wrap_widththat wraps the GtkComboBox as a table (see the GTK3 API link ).
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *combobox;
gtk_init(&argc,&argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window), 10 );
gtk_window_set_default_size(GTK_WINDOW(window), 100, 50);
combobox = gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "A" );
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "B" );
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "C" );
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), NULL, "D" );
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX(combobox), 2);
gtk_container_add(GTK_CONTAINER(window), combobox);
gtk_widget_show_all(window);
gtk_main();
return(0);
}
This gives me the following result:

As you can see, records are wrapped in a series of lines, i.e. read from left to right.
Is there a convenient way to wrap items in columns without re-sorting them ?

source
share