How to get the test from the currently selected item in a Gtkiconview?
I'm programming in C++ with the GTK+ library (not gtkmm). I have a Gtkiconview where each cell contains an icon and text. I'm relatively new to GTK. How can I get the text field from the currently selected cell? Tha开发者_如何学运维nks in advance.
EDIT: Found answer at http://www.gtkforums.com/viewtopic.php?f=3&t=55193&p=71166
I'm using GTK with python, but here is the general GTK method of doing :
- Get the path to the selected cell(s)
- take the first one (or build a for loop if you have to treat all the selected ones)
- read the text from the model (here it s assumed that the text is the first one)
selected = iconView.get_selected_items() i = selected[0][0] theText = model[i][0]
Hope this can show you the way.
精彩评论