gtk-sharpGtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Gtk.WidgetGtk.ICellEditableGtk.IEditableAn Entry is a single-line text entry widget.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 widget for displaying and editing large amounts of text.
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 ();
}
}
ConstructorConstruct a new entry widgetConstructor
To be added.
To be added.To be added.Constructor
Pointer to the C object.
Internal constructorThis is an internal constructor, and should not be used by user code.Constructor
A Public constructor.EventGLib.Signal("activate")System.EventHandlerConnect to this event to be notified when the user hits 'return'.Connect to this event with a standard .PropertyGLib.Property("activates-default")System.BooleanDetermine whether to activate the 'default widget' in the window when the return key is pressed. if the default button will be activated, false otherwise.If the value is , pressing Enter in the entry will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.
(For experts: if the value is , the entry calls on the containing the entry, in the default handler for the event).PropertySystem.SingleThe alignment for the contents of the entrya This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.
The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts
EventGLib.Signal("backspace")System.EventHandlerTo be addedTo be addedPropertyGLib.Property("buffer")Gtk.EntryBufferTo be added.To be added.To be added.PropertyGLib.Property("caps-lock-warning")System.BooleanTo be added.To be added.To be added.EventGLib.Signal("changed")System.EventHandlerWhen the contents of the Entry change, this event is raised.EventGLib.Signal("copy-clipboard")System.EventHandlerConnect to this event to be notified when the contents of the Entry are copied to the clipboard.Connect to this event with a standard .EventGLib.Signal("cut-clipboard")System.EventHandlerConnect to this event to be notified when the user 'cuts' a selection in the Entry.Connect to this event with a standard .EventGLib.Signal("paste-clipboard")System.EventHandlerConnect to this event to be notified when the clipboard contents are pasted into this Entry.Connect to this event with a standard .PropertyGtk.EntryCompletionThe auxiliary completion objecta All further configuration of the completion mechanism is done on completion using the API.MethodSystem.VoidSpecific implementation of Gtk.Editable.CopyClipboard for the Entry widget.PropertySystem.Int32To be added.To be added.To be added.PropertyGtk.AdjustmentTo be added.To be added.To be added.PropertyGLib.Property("cursor-position")System.Int32The position of the cursor in the text of the Entry.The current character of the cursor.Use this property to manipulate the position of the cursor - it is displayed before the character with the given (base 0) index in the widget. The value must be less than or equal to the number of characters in the widget. A value of -1 indicates that the position should be set after the last character in the entry. Note that this position is in characters, not in bytes.MethodSystem.VoidCopies any selected text to the clipboard and deletes it from the entry.EventGLib.Signal("delete-from-cursor")Gtk.DeleteFromCursorHandlerConnect to this event to find out when text is deleted from the Entry by the user.Data pertaining to this event is encapsulated in a .MethodSystem.VoidSpecific implementation of Gtk.Editable.DeleteSelection for the Entry widget. Deletes the currently selected text from the Entry.MethodSystem.VoidSpecific implementation of Gtk.Editable.DeleteText for the Entry widget.PropertySystem.Obsolete("Replaced by IsEditable property")System.BooleanWhether or not this Entry is editable. if this entry can be edited, otherwise.Set this property to false if you need to stop input into an Entry widget. For displaying textual data, it is more normal to use a instead.EventGLib.Signal("editing-done")System.EventHandlerImplements the EditingDone method of the interface.MethodSystem.VoidSpecific implementation of Gtk.CellEditable.FinishEditing for the Entry widget.MethodSystem.String
The index of the first character to get, (zero-indexed).
The index of the character to retrieve up to.
Specific implementation of Gtk.Editable.GetChars for the Entry widget.A string representing the characters from , up to, but not including . If is negative, then the the characters retrieved will be those characters from to the end of the text.MethodSystem.Boolean
To be added.
To be added.To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Int32
To be added.
To be added.
To be added.To be added.To be added.MethodGLib.IIcon
To be added.
To be added.To be added.To be added.MethodSystem.String
To be added.
To be added.To be added.To be added.MethodGdk.Pixbuf
To be added.
To be added.To be added.To be added.MethodSystem.Boolean
To be added.
To be added.To be added.To be added.MethodSystem.String
To be added.
To be added.To be added.To be added.MethodGtk.ImageType
To be added.
To be added.To be added.To be added.MethodSystem.String
To be added.
To be added.To be added.To be added.MethodSystem.String
To be added.
To be added.To be added.To be added.MethodSystem.Void
X offset output of the layout.
Y offset output of the layout.
Obtains the position of the PangoLayout used to render text in the entry, in widget coordinates.Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.
- Also useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the entry text is clicked.MethodSystem.Boolean
To be added.
To be added.
Get the the positions of the start and end of the current selection, if there is one. if there is a selection, otherwise.MethodSystem.Void
To be added.
To be added.To be added.PropertyGLib.GTypeGType Property.a Returns the native value for .PropertyGLib.Property("has-frame")System.BooleanWhether or not this Entry should be surrounded by a 3D frame. if a frame surrounds this Entry, otherwiseUnless there is a very specific reason for doing so, this property is best left to its default to ensure consistency in Entry widgets across applications.EventGLib.Signal("icon-press")Gtk.IconPressHandlerTo be added.To be added.EventGLib.Signal("icon-release")Gtk.IconReleaseHandlerTo be added.To be added.MethodSystem.Boolean
To be added.
To be added.To be added.To be added.PropertyGLib.Property("im-module")System.StringTo be added.To be added.To be added.PropertyGLib.Property("inner-border")Gtk.BorderTo be added.To be added.To be added.EventGLib.Signal("insert-at-cursor")Gtk.InsertAtCursorHandlerConnect to this event to discover when text is inserted at the cursor position - usually when the user types something in.Data pertaining to this event is encapsulated in an .MethodSystem.Int32
the text to add
Add arbitrary text to the entry.The number of characters added.Use this method to insert a string at the current CursorPosition.MethodSystem.Void
A
A Add text to the entry just before .PropertyGLib.Property("invisible-char")System.CharThe character to display when is a The is the character displayed in the entry in place of the actual characters of when is . The default invisible character is an asterisk ('*'). If you set this to 0, then no characters will be displayed at all.PropertyGLib.Property("invisible-char-set")System.BooleanTo be added.To be added.To be added.PropertySystem.BooleanImplements the concrete version of Gtk.Editable.IsEditable, to determine if the text of the Entry can be edited.true if the Entry is editable, false otherwise.PropertyPango.LayoutGet the object used by this Entry for text layout.The Pango.Layout used to render the text of this entry.This property is read only.MethodSystem.Int32
a To be addeda To be addedPropertyGLib.Property("max-length")System.Int32The maximum number of characters that can be placed in this Entry.The maximum number of characters that can currently be set in this Entry.This property can be useful for ensuring no more than a specific number of characters are put in an entry.EventGLib.Signal("move-cursor")Gtk.MoveCursorHandlerConnect to this event handler to be notified when the cursor of an Entry moves.Data pertaining to this event is passed with a .MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideActivated", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideBackspace", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideChanged", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideClipboardCopied", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideClipboardCut", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideClipboardPasted", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideDeleteFromCursor", Type=typeof(Gtk.Entry))System.Void
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideEditingDone", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideGetTextAreaSize", Type=typeof(Gtk.Entry))System.Void
To be added.
To be added.
To be added.
To be added.
To be added.To be added.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideIconPress", Type=typeof(Gtk.Entry))System.Void
To be added.
To be added.
Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideIconRelease", Type=typeof(Gtk.Entry))System.Void
To be added.
To be added.
Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideInsertAtCursor", Type=typeof(Gtk.Entry))System.Void
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideMoveCursor", Type=typeof(Gtk.Entry))System.Void
a
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverridePopulatePopup", Type=typeof(Gtk.Entry))System.Void
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverridePreeditChanged", Type=typeof(Gtk.Entry))System.Void
To be added.
Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideTextDeleted", Type=typeof(Gtk.Entry))System.Void
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideTextInserted", Type=typeof(Gtk.Entry))System.Void
To be added.
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideToggleOverwrite", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideWidgetRemoved", Type=typeof(Gtk.Entry))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.PropertyGLib.Property("overwrite-mode")System.BooleanTo be added.To be added.To be added.MethodSystem.VoidCauses the contents of the clipboard to be pasted into the Entry at the current cursor position.EventGLib.Signal("populate-popup")Gtk.PopulatePopupHandlerRaised when the popup handler needs to be filled with data.Data pertaining to this event is encapsulated in a .PropertySystem.Int32The position of the cursor.the current cursor positionThe cursor is displayed before the character with the given (base 0) index in the widget. The value must be less than or equal to the number of characters in the widget. A value of -1 indicates that the position should be set after the last character in the entry. Note that this position is in characters, not in bytes. EventGLib.Signal("preedit-changed")Gtk.PreeditChangedHandlerTo be added.To be added.PropertyGLib.Property("primary-icon-activatable")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-gicon")GLib.IIconTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-name")System.StringTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-pixbuf")Gdk.PixbufTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-sensitive")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-stock")System.StringTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-storage-type")Gtk.ImageTypeTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-tooltip-markup")System.StringTo be added.To be added.To be added.PropertyGLib.Property("primary-icon-tooltip-text")System.StringTo be added.To be added.To be added.PropertyGLib.Property("progress-fraction")System.DoubleTo be added.To be added.To be added.MethodSystem.VoidTo be added.To be added.PropertyGLib.Property("progress-pulse-step")System.DoubleTo be added.To be added.To be added.MethodSystem.VoidSpecific implementation of Gtk.CellEditable.RemoveWidget for the Entry widget.MethodSystem.VoidTo be added.To be added.PropertyGLib.Property("scroll-offset")System.Int32Number of pixels the entry scrolled off the screen to the left.A PropertyGLib.Property("secondary-icon-activatable")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-gicon")GLib.IIconTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-name")System.StringTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-pixbuf")Gdk.PixbufTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-sensitive")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-stock")System.StringTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-storage-type")Gtk.ImageTypeTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-tooltip-markup")System.StringTo be added.To be added.To be added.PropertyGLib.Property("secondary-icon-tooltip-text")System.StringTo be added.To be added.To be added.PropertyGLib.Property("selection-bound")System.Int32The length of the selected text.The number of selected characters.MethodSystem.Void
To be added.
To be added.
Specific implementation of Gtk.Editable.SelectRegion for the Entry widget.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.PropertyGLib.Property("shadow-type")Gtk.ShadowTypeTo be added.To be added.To be added.MethodSystem.VoidSpecific implementation of Gtk.CellEditable.StartEditing for the Entry widget.PropertyGLib.Property("text")System.StringManipulate the current text contents of an Entry.The current text in an Entry.EventGLib.Signal("delete-text")Gtk.TextDeletedHandlerConnect to this event to be notified when text is deleted from the Entry.MethodSystem.Int32
a To be addeda To be addedEventGLib.Signal("insert-text")Gtk.TextInsertedHandlerConnect to this event to be notified when text is inserted into the Entry.PropertyGLib.Property("text-length")System.UInt16To be added.To be added.To be added.EventGLib.Signal("toggle-overwrite")System.EventHandlerConnect to this event to discover when the Overwrite state has been changed by the user. This is usually done by pressing the 'Insert' key on a keyboard.Connect to this event with a standard .PropertyGLib.Property("truncate-multiline")System.BooleanIndicates if pasted text is truncated to the first line.Defaults to .MethodSystem.VoidTo be added.To be added.PropertyGLib.Property("visibility")System.BooleanDetermine whether to display characters entered, or whether to mask them.true if characters are being displayed, false if they are being masked.This property should be used to create entry widgets for sensitive data such as passwords.EventGLib.Signal("remove-widget")System.EventHandlerImplements the WidgetRemoved method of the interface. This will effectively destroy the Entry.PropertyGLib.Property("width-chars")System.Int32Changes the size request of the entry to be about the right size for characters.The number of characters requested.Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.PropertyGLib.Property("xalign")System.SingleThe horizontal alignment, from 0 (left) to 1 (right).a Reversed for RTL layouts.
Allowed values: [0,1]
Default value: 0