2014-05-09 25 views
0

我真的搜索了很多以找出答案,但没有找到任何东西。我使用glade3创建了一个comboboxtext并插入了三个文本值。 comboboxtext是一种形式,当用户按下我想要在const * char中存储的表单的确定按钮时,他选择了文本值。什么是获取文本的功能?我在GTKcombobox中看不到任何内容。从组合文本中获取文本gtk3,c

编辑:用

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)); 

我得到一个分段错误。

+0

在文本列中使用'gtk_combo_box_set_id_column()'(每个复选框一次),然后使用'gtk_combo_box_get_active_id()'(根据需要) –

回答

0

使用

gtk_combo_box_text_get_active_text (GtkComboBoxText *cmb); 

由于您没有设置gtk_combo_box_set_active_id(),你不能拉active_id。无论如何,如果您使用GtkTreeModel来填充组合框,则使用“id”。