how do I delete a row in a Gtk::ListViewText



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/



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