Iterating over Model Rows
| Chapter 8. The TreeView widget |

## Iterating over Model Rows

`Gtk::TreeModel` provides an STL-style container of its children, via the `children()` method. You can use the familiar `begin()` and `end()` methods iterator incrementing, like so:

    typedef Gtk::TreeModel::Children type_children; //minimise code length.
    type_children children = refModel->children();
    for(type_children::iterator iter = children.begin(); iter != children.end(); ++iter)
    {
      Gtk::TreeModel::Row row = *iter;
      //Do something with the row - see above for set/get.
    }

### Row children

When using a `Gtk::TreeStore`, the rows can have child rows, which can have their own children in turn. Use `Gtk::TreeModel::Row::children()` to get the STL-style container of child `Row`s:

    Gtk::TreeModel::Children children = row.children();

The View |  | The Selection