For the selected row, use get_selection(), get_selected() and with the
iterator returned by get_selected(), use erase(iterator).
For an arbitrary row, iterate over the rows of your model with
your_model->children().begin(), your_model->children().end(), etc. and use
erase() on the iterator you want.

Greetings


2013/5/27 Francis (Grizzly) Smit <[email protected]>

> Yeah I have been trying to delete a row in a Gtk::ListViewText, but I
> cannot find a member function to do this, I have tried the following
>
>     guint num_cols = get_num_columns();
>     guint num_rows = size();
>     Glib::ustring result;
>     if(num_cols == 1){
>         std::vector<Glib::ustring> tmp;
>         for(int r = 0; r < num_rows; r++){
>             if(r == row){
>                 result = get_text(r);
>             }else{
>                 tmp.insert(tmp.end(), get_text(r));
>             }
>         }
>         remove_all_columns();
>         guint n = tmp.size();
>         for(int r = 0; r < n; r++){
>             append(tmp[r]);
>         }
>     }else{
>         std::vector<std::vector<Glib::ustring> > tmp;
>         std::vector<Glib::ustring> t;
>         for(int r = 0; r < num_rows; r++){
>             if(r == row){
>                 result = get_text(r);
>             }else{
>                 t.insert(t.end(), get_text(r));
>                 for(int c = 1; c < num_cols; c++){
>                     t.insert(t.end(), get_text (r, c));
>                 }
>                 tmp.insert(tmp.end(), t);
>             }
>         }
>         remove_all_columns();
>         guint n = tmp.size();
>         for(int r = 0; r < n; r++){
>             guint _r = append(tmp[r][0]);
>             guint m = tmp[r].size();
>             for(int c = 1; c < num_cols && c < m; c++){
>                 set_text(_r, c, tmp[r][c]);
>             }
>         }
>     }
>
> but the remove_all_columns(); is too drastic I loose every thing and can
> no longer put the rows I want to keep back as append stops working as I
> have no columns any more I'd really appreciate some help on this thx
>
>
>
> --
>
>
>   .~.     In my life God comes first....
>   /V\         but Linux is pretty high after that :-D
>  /( )\    Francis (Grizzly) Smit
>  ^^-^^    http://www.smit.id.au/
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>



-- 
Atentamente:
Juan Ángel Moreno Fernández
[email protected]
------------------------------
  Proyecto Gelide
  http://gelide.sf.net
------------------------------
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to