Question

I really searched a lot to find out the answer but didn't find anything. I created a comboboxtext using glade3 and inserted three text values. The comboboxtext is in a form and when the user presses the ok button of the form I want to store in const *char the text value he chose. What is the function that gets the text? I cannot see any in GTKcombobox .

edit : with

const *char d_string;
 GtkWidget *textvalue= GTK_WIDGET(gtk_builder_get_object(builderform[0], "comboboxtext1"));
  d_string=gtk_combo_box_get_active_id(GTK_COMBO_BOX(textValue));

I get a segmentation fault.

Was it helpful?

Solution

Use

    gtk_combo_box_text_get_active_text (GtkComboBoxText *cmb);

Since you did not set gtk_combo_box_set_active_id(), you cannot pull the active_id. Anyway, the "id" is used if you use GtkTreeModel to fill up the combo box.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top