Re: how to remove selected rowS from a ListStore?



Use iconview object, delete the selected items, the code:
------------
//if use the treeview, replace the get_selected_items() with
get_selection().
	std::list<Gtk::TreeModel::Path> selected = get_selected_items();
	if(!selected.empty())
	{
		Gtk::MessageDialog dialog("Are you sure to delete?", false,
Gtk::MESSAGE_QUESTION,Gtk::BUTTONS_OK_CANCEL,true);
		int result=dialog.run();
		if (result==Gtk::RESPONSE_OK )
		{
			for(std::list<Gtk::TreeModel::Path>::iterator i=selected.begin();i!
=selected.end();i++)
			{
				Gtk::TreeModel::iterator iter = refListModel->get_iter(*i);
				Gtk::TreeModel::Row row = *iter;
				refListModel->erase(iter);
			}
		}
}
> =list.begin(); i!= list.end(); i++) {
>         // ...
>     }
> }
> 
> Which obviously doesn't work... What's the right way to do that?
> I guess I can't use get_selected_rows() without arguments, it had
> const
> cv-qualifier...
> 
> Should I use Gtk::TreeModel rather than Gtk::ListStore?
> 



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