Gtk.Combo Class
A text entry field with a dropdown list

See Also: Combo Members

Syntax

[System.Obsolete]
public class Combo : HBox

Remarks

The Gtk.Combo widget consists of a single-line text entry field and a drop-down list. The drop-down list is displayed when the user clicks on a small arrow button to the right of the entry field.

The drop-down list is a Glib.List widget and can be accessed using the list member of the Gtk.Combo. List elements can contain arbitrary widgets, but if an element is not a plain label, then you must use the Glib.List.SetItemString() function. This sets the string which will be placed in the text entry field when the item is selected.

By default, the user can step through the items in the list using the arrow (cursor) keys, though this behaviour can be turned off with Combo.UseArrows = false.

Creating a Gtk.Combo widget with simple text items:

c# Example

using System;
using Gtk;

class ComboSample
{
	Combo combo;
	
	static void Main ()
	{
		new ComboSample ();	
	}
	
	ComboSample ()
	{
		Application.Init ();
	
		Window win = new Window ("ComboSample");
		win.DeleteEvent += new DeleteEventHandler (OnWinDelete);

		string[] list = new string[] {"one", "two", "three"};
		
		combo = new Combo ();
		combo.PopdownStrings = list;
		combo.DisableActivate ();
		combo.Entry.Activated += new EventHandler (OnEntryActivated);
		
		win.Add (combo);
	
		win.ShowAll ();
		Application.Run ();
	}
	
	void OnEntryActivated (object o, EventArgs args)
	{
		Console.WriteLine (combo.Entry.Text);
	}
	
	void OnWinDelete (object obj, DeleteEventArgs args)
	{
		Application.Quit ();
	}
}
        

Requirements

Namespace: Gtk
Assembly: gtk-sharp (in gtk-sharp.dll)
Assembly Versions: 2.12.0.0