Re: Gtk::IconView & selected icon



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack. I didn't get it, did I?

You're not using a TreeView. :-)

But it looks like what you are doing is correct. And you're not going
through any kind of sort model, yes? With the TreeView object, I had a
tough time with that until I worked out that you have to convert between
models.

R. Douglas Barbieri wrote:
> It seems to me that you would want to get the selected row first using
> Gtk::TreeSelection. The "get_selected()" will give you the iterator of
> the selected row (or get_selected_rows() for multiple rows).
> 
> Olivier- wrote:
> 
>>>Hi,
>>>I would like to get back the data of the selected icon, so I have a code
>>>like that :
>>>
>>>//XDirectory inherits of Gtk::IconView
>>>XDirectory::XDirectory(.......)  {
>>>	treemodel = Gtk::ListStore::create(column);
>>>	set_model(treemodel);
>>>	set_text_column(column.name);
>>>	set_pixbuf_column(column.icon);
>>>        (...)
>>>	signal_selection_changed().connect(sigc::mem_fun(*this,
>>>&XDirectory::onSelection));
>>>}
>>>
>>>void XDirectory::onSelection() {
>>>	Gtk::IconView::ArrayHandle_TreePaths select = get_selected_items();
>>>	Gtk::TreeModel::iterator iter = treemodel->get_iter(*(select.begin()));
>>>	Gtk::TreeModel::Row row = *iter;
>>>}
>>>
>>>gdb seems to block on the second line of onSelection (... iter =
>>>treemodel->get_iter ...).
>>>I know I have only one item selected.
>>>--
>>>View this message in context: http://www.nabble.com/Gtk%3A%3AIconView-selected-icon-t1294205.html#a3444975
>>>Sent from the Gtkmm forum at Nabble.com.
>>>
>>>_______________________________________________
>>>gtkmm-list mailing list
>>>gtkmm-list gnome org
>>>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>>
> 
> 
> --
> R. Douglas Barbieri
> doug dooglio net
> http://www.dooglio.net
> 
> GPG Fingerprint: 3707 2A46 7DFC D673 FFB8  54B1 0EC9 5CF6 A1FC 6F11
> GPG recv-key   : A1FC6F11
> GPG Public key : http://www.dooglio.net/dooglio.asc
> 

- --
R. Douglas Barbieri
doug dooglio net
http://www.dooglio.net

GPG Fingerprint: 3707 2A46 7DFC D673 FFB8  54B1 0EC9 5CF6 A1FC 6F11
GPG recv-key   : A1FC6F11
GPG Public key : http://www.dooglio.net/dooglio.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEGdhbDslc9qH8bxERArHEAKCQro6vQIr3c9vqPg7Ia/Bw8Ru/vQCfe//X
C2v5Z1h8jrtPCeOrEg/vH4M=
=DSES
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]