Re: libseed-list Advanced use of Gtk.TreeView



you may need a more recent build of seed to get get_cursor to work, or try using this gir
http://devel.akbkhome.com/seed/Gtk-2.0.gir
g-ir-compiler Gtk-2.0.gir -o /usr/lib/girepository-1.0/Gtk-2.0.typelib

I suspect the version of seed you are using may not handle out args that well..

the api docs for it are here.
http://devel.akbkhome.com/seed/Gtk.TreeView.html

If gir and seed are uptodate this should work, although I've not tested it.
print(tree.get_cursor().path.to_string());

This is the other way to get it..
var iter = new Gtk.TreeIter();
var selection =  tree.get_selection(null, iter); 
print(tree.get_model().get_path(iter).to_string());

Note if path is not set, then they will fail
check with view.get_selection().get_selected_rows(view.get_model())  to see how may rows are set..

There is alot of treeview code here to look at.
http://git.akbkhome.com/?p=app.Builder.js;a=blob;f=Builder/Window.js


Regards
Alan






 --- On 26/May/2010, Olivier Tilloy wrote: 
> Hello Seed users/developers,
> 
> I'm writing my first extension for epiphany using Seed, and being
> unfamiliar with Seed I got stuck on what is probably a dumb issue, and I
> could use your help to carry on.
> I'm using a Gtk.TreeView populated with a Gtk.TreeStore model. I need to
> know when the selected item (cursor) changed, so I connect a callback to
> the cursor_changed signal:
> 
>     treeview.signal.cursor_changed.connect(cursor_changed_cb)
> 
> and in the callback itself, I want to get hold of the cursor, and this
> is where I fail miserably. I tried several things, but I couldn't get it
> to work:
> 
>     var path = tree.get_cursor()
>     print(path);
>     // [undefined]
> 
> or:
> 
>     var path = new Gtk.TreePath();
>     tree.get_cursor(path);
>     print(path);
>     // [object seed_struct]
>     print(path.to_string());
>     // GInvokeError Too few "in" arguments (handling this)
> 
> or:
> 
>     var path = new Gtk.TreePath.first();
>     tree.get_cursor(path);
>     print(path);
>     // [object seed_struct]
>     print(path.to_string());
>     // segmentation fault!
> 
> I guess I'm not calling get_cursor correctly. Or am I hitting a bug?
> 
> Help on this is much appreciated! Thanks in advance,
> 
> Olivier
> _______________________________________________
> libseed-list mailing list
> libseed-list gnome org
> http://mail.gnome.org/mailman/listinfo/libseed-list



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