Re: How to know if the Gtk::TreeModel::Children::iterator is equal to the selection



On 3/8/07, TheLonelyStar <nabble lonely-star org> wrote:

Hello dear community,

I am iterating over the items of a TreeView/ListStore using
Gtk::TreeModel::Children::iterator!

Now I want to do something special, for the selected item.
I tried:

Gtk::TreeModel::Children::iterator i;
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection; //<-The selection is
stored in here (using get_selection)

for(...)
{
...
if(i==refTreeSelection->get_selected())
..
}

This does unfortantly not work.

What would be the correct way?
Thanks!
Nathan

When you say that it doesn't work, you mean that the if() statement
never evaluates to true?  for example, if you put the following line
inside the if statement, it would never print this line?
std::cout << "I'm selected" << std::endl;

At first glance, it seems like this approach should work.  It might be
helpful if you could post a minimal testcase to see if we can spot any
errors in the code.

--
jonner



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