Re: [gtkmm] iterating through a ListView
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtkmm-list gnome org
- Cc: "Andreas B. Thun" <abt gmx de>
- Subject: Re: [gtkmm] iterating through a ListView
- Date: Sun, 22 Feb 2004 22:32:23 +0000
On Saturday 21 February 2004 15:09, Andreas B. Thun wrote:
> I´ve found a way to select the next line in a ListView
> by incrementing Gtk::TreeModel::iterator.
>
> The question is now: How can I decrement a Gtk::TreeModel::iterator??
> There is no -- operator!
>
> I want to select the prev. line..
>
>
> // Select next line in my ListView
> void ConstraintTable::onNextClicked()
> {
> Gtk::TreeModel::iterator curr_iter = m_tree_sel_ref->get_selected();
> if (curr_iter){
> if(++curr_iter) {
> Gtk::TreePath path(curr_iter);
> m_tree_sel_ref->select(curr_iter);
> m_tree_view.scroll_to_row(path);
> }
> }
> }
You have to obtain a path object and work on that, viz:
Gtk::TreeModel::Path tree_path(curr_iter);
tree_path.prev(); // tree_path now refers to the row of the list store
// preceding the selected one
Gtk::TreeModel::iterator prev_row_iter = [list_store]->get_iter(tree_path);
[list_store] is a Glib::RefPtr<Gtk::ListStore> reference to your list store
(if that's what you are using).
Chris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]