Gtk.Entry Class
An Entry is a single-line text entry widget.

See Also: Entry Members


public class Entry : Widget, CellEditable, Editable


This widget should be used to retrieve small amounts of text from the user. A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

See also the Gtk.TextView widget for displaying and editing large amounts of text.

C# Example

using System;
using Gtk;

class EntrySample
	Entry entry;

	static void Main ()
		new EntrySample ();

	EntrySample ()
		Application.Init ();
		Window win = new Window ("EntrySample");
		win.SetDefaultSize (200, 150);
		win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
		VBox vbox = new VBox (false, 1);
		win.Add (vbox);
		entry = new Entry ("hello world");
		entry.Editable = true;
		entry.Visibility = true;
		vbox.Add (entry);
		CheckButton editable = new CheckButton ("Editable");
		editable.Toggled += new EventHandler (OnEditableToggled);
		editable.Active = true;
		vbox.Add (editable);
		CheckButton visibility = new CheckButton ("Visibility");
		visibility.Toggled += new EventHandler (OnVisibilityToggled);
		visibility.Active = true;
		vbox.Add (visibility);
		win.ShowAll ();
		Application.Run ();

	void OnEditableToggled (object obj, EventArgs args)
		entry.Editable = !entry.Editable;

	void OnVisibilityToggled (object obj, EventArgs args)
		entry.Visibility = !entry.Visibility;

	void OnWinDelete (object obj, DeleteEventArgs args)
		Application.Quit ();


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