I've tried to go everywhere for an answer on this (except here!). I am starting gnome development with mono, so I have no previous gtk experience and I'm trying to figure out how I can do what I need with treeview.
I'm writing a simple address book app ala Mac OS X's address book and am pretty far along. Basically it has two paines, the left side with a list of names (using treeview) and the right side displaying the selected name's contact information. On the left side I only show the names of each contact. When it's selected I'm using this chunk of code (copied from monodoc's documentation):
this.Selection.Changed += OnSelectionChanged;
// code in between
protected void OnSelectionChanged (object o, EventArgs args)
{
TreeIter iter;
TreeModel model;
if (((TreeSelection)o).GetSelected(out model, out iter))
{
this.currentSelection = (string)model.GetValue (iter, 0);
Console.WriteLine ("{0} was selected", this.currentSelection);
}
this.mainWindowAccessor.ChangeContactByName(this.currentSelection);
}
This tells me when one is selected, giving me that contracts name as shown in the treeview.
It works nice for getting the selected name but as in just about any database app, it would be much more useful to have a way of retrieving the contact_id when I select a name (since the possibility exists of having a duplicate name, etc). I do web development so I'm used to having a select widget that I can define each option like so: <option value="22">Name</option>. This allows me to dispaly "Name" but it returns the id "22" when selected. I know treeview is much more advanced than the simple HTML select widget but can I achieve this same thing using treeview.
I would really appreciate any help on this since it's basically preventing me from going any further with this app (and my mono learning in general).
Thanks much in advance!
--
-Clark Endrizzi
_______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
