GtkEntry

Share:

Description

A single line text entry field

Methods and Functions

gtkEntryNew(show = TRUE)
gtkEntryNewWithBuffer(buffer, show = TRUE)
gtkEntryNewWithMaxLength(max = 0, show = TRUE)
gtkEntryGetBuffer(object)
gtkEntrySetBuffer(object, buffer)
gtkEntrySetText(object, text)
gtkEntryAppendText(object, text)
gtkEntryPrependText(object, text)
gtkEntrySetPosition(object, position)
gtkEntryGetText(object)
gtkEntryGetTextLength(object)
gtkEntrySelectRegion(object, start, end)
gtkEntrySetVisibility(object, visible)
gtkEntrySetInvisibleChar(object, ch)
gtkEntryUnsetInvisibleChar(object)
gtkEntrySetEditable(object, editable)
gtkEntrySetMaxLength(object, max)
gtkEntryGetActivatesDefault(object)
gtkEntryGetHasFrame(object)
gtkEntryGetInnerBorder(object)
gtkEntryGetWidthChars(object)
gtkEntrySetActivatesDefault(object, setting)
gtkEntrySetHasFrame(object, setting)
gtkEntrySetInnerBorder(object, border = NULL)
gtkEntrySetWidthChars(object, n.chars)
gtkEntryGetInvisibleChar(object)
gtkEntrySetAlignment(object, xalign)
gtkEntryGetAlignment(object)
gtkEntrySetOverwriteMode(object, overwrite)
gtkEntryGetOverwriteMode(object)
gtkEntryGetLayout(object)
gtkEntryGetLayoutOffsets(object)
gtkEntryLayoutIndexToTextIndex(object, layout.index)
gtkEntryTextIndexToLayoutIndex(object, text.index)
gtkEntryGetMaxLength(object)
gtkEntryGetVisibility(object)
gtkEntrySetCompletion(object, completion)
gtkEntryGetCompletion(object)
gtkEntrySetCursorHadjustment(object, adjustment)
gtkEntryGetCursorHadjustment(object)
gtkEntrySetProgressFraction(object, fraction)
gtkEntryGetProgressFraction(object)
gtkEntrySetProgressPulseStep(object, fraction)
gtkEntryGetProgressPulseStep(object)
gtkEntryProgressPulse(object)
gtkEntrySetIconFromPixbuf(object, icon.pos, pixbuf = NULL)
gtkEntrySetIconFromStock(object, icon.pos, stock.id = NULL)
gtkEntrySetIconFromIconName(object, icon.pos, icon.name = NULL)
gtkEntrySetIconFromGicon(object, icon.pos, icon = NULL)
gtkEntryGetIconStorageType(object, icon.pos)
gtkEntryGetIconPixbuf(object, icon.pos)
gtkEntryGetIconStock(object, icon.pos)
gtkEntryGetIconName(object, icon.pos)
gtkEntryGetIconGicon(object, icon.pos)
gtkEntrySetIconActivatable(object, icon.pos, activatable)
gtkEntryGetIconActivatable(object, icon.pos)
gtkEntrySetIconSensitive(object, icon.pos, sensitive)
gtkEntryGetIconSensitive(object, icon.pos)
gtkEntryGetIconAtPos(object, x, y)
gtkEntrySetIconTooltipText(object, icon.pos, tooltip = NULL)
gtkEntryGetIconTooltipText(object, icon.pos)
gtkEntrySetIconTooltipMarkup(object, icon.pos, tooltip = NULL)
gtkEntryGetIconTooltipMarkup(object, icon.pos)
gtkEntrySetIconDragSource(object, icon.pos, target.list, actions)
gtkEntryGetCurrentIconDragSource(object)
gtkEntryGetIconWindow(object, icon.pos)
gtkEntryGetTextWindow(object)
gtkEntry(max = 0, buffer, show = TRUE)

Hierarchy

1
2
3
4
5
6
GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkEntry
                           +----GtkSpinButton

Interfaces

GtkEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

Detailed Description

The GtkEntry widget is a single line text entry widget. 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.

When using an entry for passwords and other sensitive information, it can be put into "password mode" using gtkEntrySetVisibility. In this mode, entered text is displayed using a 'invisible' character. By default, GTK+ picks the best invisible character that is available in the current font, but it can be changed with gtkEntrySetInvisibleChar. Since 2.16, GTK+ displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the "caps-lock-warning" property.

Since 2.16, GtkEntry has the ability to display progress or activity information behind the text. To make an entry display such information, use gtkEntrySetProgressFraction or gtkEntrySetProgressPulseStep.

Additionally, GtkEntry can show icons at either side of the entry. These icons can be activatable by clicking, can be set up as drag source and can have tooltips. To add an icon, use gtkEntrySetIconFromGicon or one of the various other functions that set an icon from a stock id, an icon name or a pixbuf. To trigger an action when the user clicks an icon, connect to the "icon-press" signal. To allow DND operations from an icon, use gtkEntrySetIconDragSource. To set a tooltip on an icon, use gtkEntrySetIconTooltipText or the corresponding function for markup.

Note that functionality or information that is only available by clicking on an icon in an entry may not be accessible at all to users which are not able to use a mouse or other pointing device. It is therefore recommended that any such functionality should also be available by other means, e.g. via the context menu of the entry.

Structures

GtkEntry

The GtkEntry struct contains only private data.

Convenient Construction

gtkEntry is the result of collapsing the constructors of GtkEntry (gtkEntryNew, gtkEntryNewWithMaxLength, gtkEntryNewWithBuffer) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

Enums and Flags

GtkEntryIconPosition

Specifies the side of the entry at which an icon is placed.

primary

At the beginning of the entry (depending on the text direction).

secondary

At the end of the entry (depending on the text direction).

Signals

activate(entry, user.data)

A keybinding signal which gets emitted when the user activates the entry.

Applications should not connect to it, but may emit it with gSignalEmitByName() if they need to control activation programmatically.

The default bindings for this signal are all forms of the Enter key.

entry

The entry on which the signal is emitted

user.data

user data set when the signal handler was connected.

backspace(entry, user.data)

The ::backspace signal is a keybinding signal which gets emitted when the user asks for it.

The default bindings for this signal are Backspace and Shift-Backspace.

entry

the object which received the signal

user.data

user data set when the signal handler was connected.

copy-clipboard(entry, user.data)

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard.

The default bindings for this signal are Ctrl-c and Ctrl-Insert.

entry

the object which received the signal

user.data

user data set when the signal handler was connected.

cut-clipboard(entry, user.data)

The ::cut-clipboard signal is a keybinding signal which gets emitted to cut the selection to the clipboard.

The default bindings for this signal are Ctrl-x and Shift-Delete.

entry

the object which received the signal

user.data

user data set when the signal handler was connected.

delete-from-cursor(entry, type, count, user.data)

The ::delete-from-cursor signal is a keybinding signal which gets emitted when the user initiates a text deletion.

If the type is GTK_DELETE_CHARS, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters.

The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for deleting a word.

entry

the object which received the signal

type

the granularity of the deletion, as a GtkDeleteType

count

the number of type units to delete

user.data

user data set when the signal handler was connected.

icon-press(entry, icon.pos, event, user.data)

The ::icon-press signal is emitted when an activatable icon is clicked. Since 2.16

entry

The entry on which the signal is emitted

icon.pos

The position of the clicked icon

event

the button press event

user.data

user data set when the signal handler was connected.

icon-release(entry, icon.pos, event, user.data)

The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon. Since 2.16

entry

The entry on which the signal is emitted

icon.pos

The position of the clicked icon

event

the button release event

user.data

user data set when the signal handler was connected.

insert-at-cursor(entry, string, user.data)

The ::insert-at-cursor signal is a keybinding signal which gets emitted when the user initiates the insertion of a fixed string at the cursor.

This signal has no default bindings.

entry

the object which received the signal

string

the string to insert

user.data

user data set when the signal handler was connected.

move-cursor(entry, step, count, extend.selection, user.data)

The ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement. If the cursor is not visible in entry, this signal causes the viewport to be moved instead.

Applications should not connect to it, but may emit it with gSignalEmitByName() if they need to control the cursor programmatically.

The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.

entry

the object which received the signal

step

the granularity of the move, as a GtkMovementStep

count

the number of step units to move

extend.selection

TRUE if the move should extend the selection

user.data

user data set when the signal handler was connected.

paste-clipboard(entry, user.data)

The ::paste-clipboard signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view.

The default bindings for this signal are Ctrl-v and Shift-Insert.

entry

the object which received the signal

user.data

user data set when the signal handler was connected.

populate-popup(entry, menu, user.data)

The ::populate-popup signal gets emitted before showing the context menu of the entry.

If you need to add items to the context menu, connect to this signal and append your menuitems to the menu.

entry

The entry on which the signal is emitted

menu

the menu that is being populated

user.data

user data set when the signal handler was connected.

preedit-changed(entry, preedit, user.data)

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal. Since 2.20

entry

the object which received the signal

preedit

the current preedit string

user.data

user data set when the signal handler was connected.

toggle-overwrite(entry, user.data)

The ::toggle-overwrite signal is a keybinding signal which gets emitted to toggle the overwrite mode of the entry.

The default bindings for this signal is Insert.

entry

the object which received the signal

user.data

user data set when the signal handler was connected.

Properties

activates-default [logical : Read / Write]

Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed. Default value: FALSE

buffer [GtkEntryBuffer : * : Read / Write / Construct]

Text buffer object which actually stores entry text.

caps-lock-warning [logical : Read / Write]

Whether password entries will show a warning when Caps Lock is on.

Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose. Default value: TRUE Since 2.16

cursor-position [integer : Read]

The current position of the insertion cursor in chars. Allowed values: [0,65535] Default value: 0

editable [logical : Read / Write]

Whether the entry contents can be edited. Default value: TRUE

has-frame [logical : Read / Write]

FALSE removes outside bevel from entry. Default value: TRUE

im-module [character : * : Read / Write]

Which IM (input method) module should be used for this entry. See GtkIMContext.

Setting this to a non-NULL value overrides the system-wide IM module setting. See the GtkSettings "gtk-im-module" property. Default value: NULL Since 2.16

inner-border [GtkBorder : * : Read / Write]

Sets the text area's border between the text and the frame. Since 2.10

invisible-char [numeric : Read / Write]

The invisible character is used when masking entry contents (in \"password mode\")"). When it is not explicitly set with the "invisible-char" property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

This style property allows the theme to prepend a character to the list of candidates. Default value: '*' Since 2.18

invisible-char-set [logical : Read / Write]

Whether the invisible char has been set for the GtkEntry. Default value: FALSE Since 2.16

max-length [integer : Read / Write]

Maximum number of characters for this entry. Zero if no maximum. Allowed values: [0,65535] Default value: 0

overwrite-mode [logical : Read / Write]

If text is overwritten when typing in the GtkEntry. Default value: FALSE Since 2.14

primary-icon-activatable [logical : Read / Write]

Whether the primary icon is activatable.

GTK+ emits the "icon-press" and "icon-release" signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes. Default value: FALSE Since 2.16

primary-icon-gicon [GIcon : * : Read / Write]

The GIcon to use for the primary icon for the entry. Since 2.16

primary-icon-name [character : * : Read / Write]

The icon name to use for the primary icon for the entry. Default value: NULL Since 2.16

primary-icon-pixbuf [GdkPixbuf : * : Read / Write]

A pixbuf to use as the primary icon for the entry. Since 2.16

primary-icon-sensitive [logical : Read / Write]

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK+ does not emit the "icon-press" and "icon-release" signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available. Default value: TRUE Since 2.16

primary-icon-stock [character : * : Read / Write]

The stock id to use for the primary icon for the entry. Default value: NULL Since 2.16

primary-icon-storage-type [GtkImageType : Read]

The representation which is used for the primary icon of the entry. Default value: GTK_IMAGE_EMPTY Since 2.16

primary-icon-tooltip-markup [character : * : Read / Write]

The contents of the tooltip on the primary icon, which is marked up with the Pango text markup language.

Also see gtkEntrySetIconTooltipMarkup. Default value: NULL Since 2.16

primary-icon-tooltip-text [character : * : Read / Write]

The contents of the tooltip on the primary icon.

Also see gtkEntrySetIconTooltipText. Default value: NULL Since 2.16

progress-fraction [numeric : Read / Write]

The current fraction of the task that's been completed. Allowed values: [0,1] Default value: 0 Since 2.16

progress-pulse-step [numeric : Read / Write]

The fraction of total entry width to move the progress bouncing block for each call to gtkEntryProgressPulse. Allowed values: [0,1] Default value: 0.1 Since 2.16

scroll-offset [integer : Read]

Number of pixels of the entry scrolled off the screen to the left. Allowed values: >= 0 Default value: 0

secondary-icon-activatable [logical : Read / Write]

Whether the secondary icon is activatable.

GTK+ emits the "icon-press" and "icon-release" signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes. Default value: FALSE Since 2.16

secondary-icon-gicon [GIcon : * : Read / Write]

The GIcon to use for the secondary icon for the entry. Since 2.16

secondary-icon-name [character : * : Read / Write]

The icon name to use for the secondary icon for the entry. Default value: NULL Since 2.16

secondary-icon-pixbuf [GdkPixbuf : * : Read / Write]

An pixbuf to use as the secondary icon for the entry. Since 2.16

secondary-icon-sensitive [logical : Read / Write]

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK+ does not emit the "icon-press" and "icon-release" signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available. Default value: TRUE Since 2.16

secondary-icon-stock [character : * : Read / Write]

The stock id to use for the secondary icon for the entry. Default value: NULL Since 2.16

secondary-icon-storage-type [GtkImageType : Read]

The representation which is used for the secondary icon of the entry. Default value: GTK_IMAGE_EMPTY Since 2.16

secondary-icon-tooltip-markup [character : * : Read / Write]

The contents of the tooltip on the secondary icon, which is marked up with the Pango text markup language.

Also see gtkEntrySetIconTooltipMarkup. Default value: NULL Since 2.16

secondary-icon-tooltip-text [character : * : Read / Write]

The contents of the tooltip on the secondary icon.

Also see gtkEntrySetIconTooltipText. Default value: NULL Since 2.16

selection-bound [integer : Read]

The position of the opposite end of the selection from the cursor in chars. Allowed values: [0,65535] Default value: 0

shadow-type [GtkShadowType : Read / Write]

Which kind of shadow to draw around the entry when "has-frame" is set to TRUE. Default value: GTK_SHADOW_IN Since 2.12

text [character : * : Read / Write]

The contents of the entry. Default value: ""

text-length [numeric : Read]

The length of the text in the GtkEntry. Allowed values: <= 65535 Default value: 0 Since 2.14

truncate-multiline [logical : Read / Write]

When TRUE, pasted multi-line text is truncated to the first line. Default value: FALSE Since 2.10

visibility [logical : Read / Write]

FALSE displays the "invisible char" instead of the actual text (password mode). Default value: TRUE

width-chars [integer : Read / Write]

Number of characters to leave space for in the entry. Allowed values: >= -1 Default value: -1

xalign [numeric : Read / Write]

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts. Allowed values: [0,1] Default value: 0 Since 2.4

Style Properties

icon-prelight [logical : Read]

The prelight style property determines whether activatable icons prelight on mouseover. Default value: TRUE Since 2.16

inner-border [GtkBorder : * : Read]

Sets the text area's border between the text and the frame. Since 2.10

invisible-char [numeric : Read]

The invisible character is used when masking entry contents (in \"password mode\")"). When it is not explicitly set with the "invisible-char" property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

This style property allows the theme to prepend a character to the list of candidates. Default value: 0 Since 2.18

progress-border [GtkBorder : * : Read]

The border around the progress bar in the entry. Since 2.16

state-hint [logical : Read]

Indicates whether to pass a proper widget state when drawing the shadow and the widget background. Default value: FALSE Since 2.16

Author(s)

Derived by RGtkGen from GTK+ documentation

References

http://library.gnome.org/devel//gtk/GtkEntry.html

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.