Re: [gtkmm] Erasing TreeModel rows...
- From: Kjell Irgens <kjell spacetec no>
- To: Dennis Craven <linuxnewb rogers com>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Erasing TreeModel rows...
- Date: Thu, 26 Feb 2004 08:54:29 +0100
On Wed, Feb 25, 2004 at 11:05:19PM -0500, Dennis Craven wrote:
> Hey,
>
> I've been following the documentation and examples online and in the
> distribution. They are helpful, but a little unclear about removing rows
> from TreeModels. Here is the function that I have attempting to do the
> dirty work.
>
> void MyTreeView::deleteRow(Glib::ustring title)
> {
> Gtk::TreeModel::Children children = treestore->children();
>
> for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter
> != children.end(); ++iter)
> {
> Gtk::TreeModel::Row row = *iter;
> if (row[columns.m_col_name] == title) {
>
> ////
> // Segfaults on this erase line. "treestore" is declared as
> // Glib::RefPtr<Gtk::TreeStore> treestore;
> // and is a protected member of the MyTreeView class.
> ////
> treestore->erase(iter);
> break;
> }
> }
> }
Don't know, this works to delete all elements in some code I have here:
Gtk::TreeModel::Children::iterator iter = _model->children().begin();
while (iter != _model->children().end())
{
iter = _model->erase (iter);
}
--
--Kjell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]