[gtkmm] How do you determine iterator 'type' for get_children.begin() ?
- From: Jeff Gavin <jeff ezclick net>
- To: gtkmm-list gnome org
- Subject: [gtkmm] How do you determine iterator 'type' for get_children.begin() ?
- Date: Wed, 11 Jun 2003 12:07:57 -0500
I'm trying to loop through each button in a button box and collect the
pointers to each of the button widgets. So far I can do the following
because I know that there are 8 buttons in the button box.
button[0] = (Gtk::Button *) *(buttonbox->get_children().begin());
button[1] = (Gtk::Button *) *(buttonbox->get_children().begin()++);
button[7] = (Gtk::Button *) *(buttonbox->get_children().end());
The above code compiles and does what I want, it gives me the first,
second, and last button in my button box.
I cannot figure out what type 'i' should be in this example:
<WHAT TYPE GOES HERE?> i;
for (i = buttonbox->get_children().begin();
i <= buttonbox->get_children().end();
i++)
{
button[j] = *(i);
}
How do you determine the type of the iterator. I have tried to find an
example but cannot. I have read and re-read the online documentation
for ListHandle and am very lost.
I even compiled the program with the type of 'int' and the compiler
complained:
cannot convert
`Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Gtk::Widget*>
>' to `int' in assignment
I was hoping that the error message would give me a hint, but I'm still
not able to figure out the correct type to use for the iterator.I know
that an experienced C++ programmer would then know exactly what type to
use, but alas, I'm still new to C++.
Thanks for your help.
Jeff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]