开发者

How to get the test from the currently selected item in a Gtkiconview?

开发者 https://www.devze.com 2023-04-07 01:47 出处:网络
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 s

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消