[Gtk-sharp-list] Drop-down list

Victor Rafael Rivarola Soerensen (FANATICO y LOCO por Cristo) vrrivaro at gmail.com
Fri Apr 14 00:44:07 EDT 2006


2006/4/13, Finn Gruwier Larsen <finn at gruwier.dk>:
> Chris Wilson skrev:
> > You probably want attach a ListStore to the ComboBox' Model. The gives
> > you a way to attach a list store with 2 columns to the ComboBox: one
> > for an index into your ArrayList and the other to display.  You can
> > then get the active row and use the index column in the ListView to
> > get into the Array.
> >
> > Take a look at the tutorial for using the TreeView at:
> > http://www.mono-project.com/GtkSharp_TreeView_Tutorial
> >
> > It will show you how to setup a ListStore (The one-dimension version
> > of the TreeStore).
> >
> > Hope that point you in the right direction.
>
> I think I'm beginning to get it.
>
> I have this:
>
> //I need objects of class Address, so I make a ListStore
> // with two "columns": one containing the text, one containg the object
> ListStore ls = new ListStore(typeof(string), typeof(Address));
>
> //I need to fetch the objects from the ArrayList currentUnit.Addresses
> foreach(Address a in currentUnit.Addresses)
> {
>         ls.AppendValues(a.ToString(), a);
> }
>
> The problem now is that the combo does not display anything. I think
> what I need now a way to "tell" the combo that the values to display are
> in the first "column".
>
> Regards,
>
> Finn Gruwier Larsen
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>

Read that tutorial again. The answer that you need is right there.

http://www.mono-project.com/GtkSharp_TreeView_Tutorial#Controlling_how_the_model_is_used

Jesus bless you,

Víctor Rafael Rivarola

--
FANÁTICO
"Por cuanto eres tibio, y no frío ni caliente, te vomitaré de mi boca."
Apocalipsis 3:16

LOCO
"Porque la Palabra de la Cruz es locura para los que se pierden; pero a
los que se salvan, esto es, a nosotros, es poder de Dios."
1 Corintios 1:18


More information about the Gtk-sharp-list mailing list