Re: [gtkmm] TreeView



Bart Verstraete wrote:

Daniel J. Lauk wrote:

You get a Gtk::TreeModel::Row when you dereference a Gtk::TreeModel::iterator,
like in the example code at
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08.html#id2510508

<code>
Gtk::TreeModel::iterator iter = m_refListStore->append();
Gtk::TreeModel::Row row = *iter;
</code>

I'd suggest you read the sources of the examples in the documentation and of
the gtkmm-demo and keep reading the reference documentation parallel. This is
what helped me a lot on using all the "tree things" ;-)

Best regards,

DJ

Matthias Kestenholz wrote:

Hi guys could somebody help me?
In a treeview, when I populate it, I want a particular row selected(during the populating i think) and also i wane have it
expanded

so I can see the underlaying targets but I can't find out how to do
this.




hi

it seems to me that if you append/insert/prepend a row to the treestore
you get an iterator as return value... using this iterator it should be
simple to get everything else you'd need.

Something along the lines of:

Gtk::TreeModel::iterator iter = mrefTreeStore->append();
Gtk::TreeModel::Path path = mrefTreeStore->get_path( iter );
Glib::RefPtr<Gtk::TreeSelection> refSelection =
	mTreeView->get_selection();
refSelection->select( path );

But perhaps you don't even need to do it half so complicated:

http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeSelection.html#a21

you can pass iterators, rows or paths to the TreeSelection object, no
need to do any conversions between them just to select a row!

If you want to expand the node you need the path anyway, so you can use
the first code fragment I posted. If you want to expand a row you have
to use

mTreeView->expand_row( path, [true|false] );

http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeView.html#a60

hth

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



if I let the append retunr a 'iterator' I can't adjust the value of the columns anymore, like: 'row[column] = "blabla". And I don't find how to get the row from a iterator or vice versa. also the function you use here, 'mrefTreeStore->get_path( iter )' that function isn't documantated od did I overlook it?

thx for your help, Bart

I tried what you guys said and it worked thx. But now there is somethinng else. Is there a signal or single click I use now 'm_dirTV.signal_row_activated().connect( sigc::mem_fun(*this, &dirView::on_treeview_row_activated) );' for a doubleclickaction. According to the docs there are only like 5 signals. I probably misst it so pls help me out of this, :)

grtz Bart

------------------------------------------------------------------------

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Hehe found it already via the treeselection object it has a signalhandler 'signal_on_changed'. but thx for the help



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