Hiding individual TreeRows



Hi all,

I've been experimenting with different ways to hide individual TreeRows on the fly, but with limited success. Basically if a row's name begins with a " . " then I'd like to hide it, but not necessarily erase it from the TreeView using erase() since I'd like to be able to reverse this action without recreating the entire view. I was looking around the mailing list archives and I stumbled upon this post:

http://marc.theaimsgroup.com/?l=gtkmm&m=109957757907166&w=2

That appears to be in the ballpark of what I'd like to do, but I'm not sure exactly how to implement it (I'm new to both c++ and gtkmm).

The relevant code I've been kicking around is this:

void hide_hidden_files() {

   Gtk::TreeModel::Children children = refTreeModel->children();

   Gtk::TreeModel::Children::iterator iter = children.begin();

   while(iter != children.end()){


      Gtk::TreeModel::Row row = *iter;

      Glib::ustring colName = row[mColumns.colName];

      if(colName[0] == 46){  //46 being ascii " . "

         //something here to hide the row (??)
         //This next line works, but I'd rather hide the row
         //rather than erase() it.

         iter = refTreeModel->erase(iter);

      } else { iter++; }

  }

}

This looks a little sloppy, but I'm learning as I go. Any tips are much appreciated.

Thanks,
Matt Bragano



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