[Gtk-sharp-list] TreeView nightmares

Aaron Oxford aaron at hardwarehookups.com.au
Wed Mar 14 08:50:40 EDT 2007

Hi again list,

So how about these TreeViews...  :-\  I can't figure out how to use 
one as an efficient view of an internal collection at all. Is there 
some way I can just interact directly with the objects in the list or 
the view? Sorry to ask so many newbie questions, but please help 
again - I'm *this* close to writing my own VBox of clickable Labels! :-)

Thanks to everyone who replied RE threading. One more thing there, do 
I need to do anything special if I want to access a widget from a 
timeout callback? I'm still getting the odd crash, and I'm pretty 
sure the only thread running is the one doing the timeouts. I have 
other threads running but they are all separated from the GUI either 
completely or via the timeouts.

Sorry for another long email, but here's the background for anyone 
who wants to reply:

I got over the idea of having to keep a reference to the widget as 
well as the ListStore in order to do the basic operations. That 
almost made sense, but then it seemed that for something as simple as 
getting the value of the activated row in the RowActivated handler 
also requires an TreeIter on the store, and all you have is a Path, 
not a link to the widget or to the row data. What really bummed me 
was when I discovered that this iterater refuses to store and 
retrieve raw objects, complaining about its limited set of types and 
the fact that my index column data isn't one of them.

Alright, ranting aside, how does one usually link the data in the 
ListStore back to other objects? All I'm trying to do here is operate 
a simple list of named internal objects that, when double clicked, 
cause further information to be displayed. I could iterate through my 
own list using some artifically generated index (which would then be 
displayed alongside the object's name) in order to link back to my 
internal objects, but I can't believe that's the way it was intended 
to be used.

I've been through the Gtk API multiple times to no avail, and the SDK 
sample sucks - there's no interaction or even run-time modification 
of the list. Did I miss a simple [ ] indexing operator defined 
somewhere or what?

Aaron Oxford   -   aaron+hardwarehookups .com .au
Director, Innovative Computer Solutions (Aust) Pty. Ltd.
49 Maitland Rd, Mayfield, NSW 2304 Australia
Developer, SourceForge project VioLet Composer

More information about the Gtk-sharp-list mailing list