[Gtk-sharp-list] Gtk.ComboBox?
Sergio Duran
Sergio Duran <sergioduran@gmail.com>
Sat, 18 Dec 2004 09:54:29 -0600
I'm not an expert on the subject but here it goes... ComboBox, is
available with gtk# 1.9 (development version). I used pygtk
documentation for reference, ComboBoxes are a lot like TreeViews with
some minor differences.
This is a small example I can think of. Feel free to correct me if I
do something wrong, anyone, I know I'm not the best :)
ComboBox combo =3D new ComboBox();
// I use a name and an invisible ID
ListStore store =3D new Store(typeof(string), typeof(int));=20
CellRendererText text =3D new CellRendererText();
combo.PackStart(text, false);
combo.AddAttribute(text, "text", 0);
TreeIter iter;
iter =3D store.AppendValues("-- Select", 0);
combo.SetActiveIter(iter);
store.AppendValues("Item 1", 1);
store.AppendValues("Item 90", 90);
// this is how I do the loops, one could use the
// Foreach method or I guess there's a better way
// well, if there is, i'd be glad to know :)
if(store.GetIterFirst(out iter)) {
do {
int id =3D store.GetValue(iter, 1);
string name =3D store.GetValue(iter, 0);
Console.WriteLine("{0}: {1}", id, name);
} while(store.IterNext(ref iter))
}
On Sat, 18 Dec 2004 15:20:44 +0100, Viktor Stansvik <vstansvik@home.se> wro=
te:
> Hmm. I just found people in the archives of this list that has used the
> ComboBox, and when thinking about it MonoDevelop does too. However, the
> documentation on go-mono.org says it's not implemented, and when I try
> to compile a program that make use of it, I get unresolved symbols
> messages.
>=20
> Can anyone enlighten me on this?
>=20
> -- viktor
>=20
> On l=F6r, 2004-12-18 at 15:11 +0100, Viktor Stansvik wrote:
> > Hi,
> > I was just wondering whether any work on implementing Gtk.ComboBox is
> > being done? I would do it myself if I had the skills, but I don't think
> > that I have. It's quite a critical widget I think.
> >
> > Thanks,
> > -- viktor
> >
> > _______________________________________________
> > Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >
>=20
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>