Hello. Happy New Year!
I need simple example for Gtk.ComboBox usage as DropDownList (value only set from list, no write).
Check Monodoc I think what you are looking for should be in the sample code in the overview section. It's also located in the web version of the documentation at http://www.go-mono.com/docs/ under Gnome Libraries->Gtk->ComboBox Class. Just in case you cannot access the web documentation (but somehow able to read email...), or access/build Monodoc, I've pasted the sample code from said documentation below...
using System;
using Gtk;
class ComboBoxSample
{
static void Main ()
{
new ComboBoxSample ();
}
ComboBoxSample ()
{
Application.Init ();
Window win = new Window ("ComboBoxSample");
win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
ComboBox combo = ComboBox.NewText ();
for (int i = 0; i < 5; i ++)
combo.AppendText ("item " + i);
combo.Changed += new EventHandler (OnComboBoxChanged);
win.Add (combo);
win.ShowAll ();
Application.Run ();
}
void OnComboBoxChanged (object o, EventArgs args)
{
ComboBox combo = o as ComboBox;
if (o == null)
return;
TreeIter iter;
if (combo.GetActiveIter (out iter))
Console.WriteLine ((string) combo.Model.GetValue (iter, 0));
}
void OnWinDelete (object obj, DeleteEventArgs args)
{
Application.Quit ();
}
}
Thanks.
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
Happy Hacking!
--
Nick Granado
_______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
