Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 如何获得gtklistboxrow的孩子?_C_Gtk_Gtk3 - Fatal编程技术网

C 如何获得gtklistboxrow的孩子?

C 如何获得gtklistboxrow的孩子?,c,gtk,gtk3,C,Gtk,Gtk3,如果在列表框中添加项目,则可以使用list_box.insert()执行此操作;现在有一个项目,您可以选择它。例如,它是一个条目(文本框)。但是现在我想按下一个按钮,给我输入的值。我在列表框或列表框行的引用中找不到返回任何兼容对象的函数。 我试过这样的东西: gtk_entry_get_text(GTK_ENTRY(gtk_list_box_get_selected_row(GTK_LIST_BOX(listbox)))); //listbox is a variable of typ GtkW

如果在列表框中添加项目,则可以使用list_box.insert()执行此操作;现在有一个项目,您可以选择它。例如,它是一个条目(文本框)。但是现在我想按下一个按钮,给我输入的值。我在列表框或列表框行的引用中找不到返回任何兼容对象的函数。 我试过这样的东西:

gtk_entry_get_text(GTK_ENTRY(gtk_list_box_get_selected_row(GTK_LIST_BOX(listbox)))); //listbox is a variable of typ GtkWidget and contains the listbox in

但它不起作用。有人有解决办法吗?我的意思是,如果你不能使用所选的东西,那么考虑一个列表框是有点没用的。p> GtkListBoxRow是一个GTK容器。特别是(单个项目)GtkBin:

您应该能够拨打:

gtk_bin_get_child(GTK_BIN(listboxrow));

请注意,
GtkListBoxRow
只能有一个子项,尽管
GtkListBoxRow
可以有多个子项,但这是正确答案。谢谢但列表框是我的列表框。因此,对于所有会读到这篇文章的人来说,正确的答案是:gtk_bin_get_child(gtk_list_box_get_selected_row(gtk_list_box(listbox)));谢谢我做了一个小编辑,将我的答案中的listbox更改为listboxrow。