[Gtk-sharp-list] Drop-down list
Finn Gruwier Larsen
finn at gruwier.dk
Thu Apr 13 04:59:05 EDT 2006
Victor Rafael Rivarola Soerensen (FANATICO y LOCO por Cristo) skrev:
>
>
> 2006/4/13, Finn Gruwier Larsen <finn at gruwier.dk <mailto:finn at gruwier.dk>>:
>
> I need to make a simple drop-down list in my application. The list items
> should corespond with an ArrayList of objects, and when the user
> chooses an item, an object variable should be set to the object that
> coresponds with the chosen list item.
>
> I have tried to study the documentation for ComboBox, but I can't figure
> out how to pair the ComboBox with my ArrayList.
>
>
> System.Collections.ArrayList al;
> string [] ar [al.Count];
> // Fill ar here somehow.
> al.CopyTo (ar);
> Gtk.ComboBox combo = new Gtk.ComboBox (ar);
I can make the combo box and make it show the relevant information. But
what will the comboChanged event handler look like? Note that I'm not
interested in getting the text fra the combo, but getting the actual
object: if item #2 i chosen from the combo, I want a reference to the
2.nd object in the ArrayList. Somehow I need to get the index number of
the chosen item.
Best regards,
Finn G. Larsen
More information about the Gtk-sharp-list
mailing list