Re: [gtkmm] TreeView

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
so I can see the underlaying targets but I can't find out how to do


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 =
refSelection->select( path );

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

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] );


gtkmm-list mailing list
gtkmm-list gnome org

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

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