Reputation: 303
If you add items in a listbox you do this with list_box.insert(); Now there is a item and you can select it. For my example its a entry (textbox). But now I want to press an Button and give me the value of the entry out. I found no function in the reference for the list_box or for the list_box_row to give back any compatible object. I tried stuff like this:
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
But its not working. Anyone have a solution for it? I mean it would be a bit useless to consider a listbox if you cant work with the selected stuff.
Upvotes: 1
Views: 1373
Reputation: 2123
GtkListBoxRow is a GtkContainer. Specifically a (single item) GtkBin: https://developer.gnome.org/gtk3/stable/GtkListBox.html#GtkListBoxRow
You should be able to call:
gtk_bin_get_child(GTK_BIN(listboxrow));
Note that a GtkListBoxRow
can have only one child, though a GtkListBox
can have multiple GtkListBoxRows
.
Upvotes: 3