[Gtk-sharp-list] Drop-down list
blixtra at gmail.com
Thu Apr 13 18:03:29 EDT 2006
You probably need to do something like the following:
groupCombo.Model = groupStore;
CellRendererText cr = new CellRendererText ();
groupCombo.PackStart (cr, true);
groupCombo.AddAttribute (cr, "text", 0);
That should fix the invisible entry issue.
On 4/13/06, Finn Gruwier Larsen <finn at gruwier.dk> wrote:
> 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".
> Finn Gruwier Larsen
More information about the Gtk-sharp-list