1.55 <GtkEntry>

Class: <GtkEntry>

It derives from <GtkWidget>.

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 entry:set-visibility. 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 entry:set-invisible-char.

<GtkEntry> has the ability to display progress or activity information behind the text. To make an entry display such information, use entry:set-progress-fraction or entry:set-progress-pulse-step.

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 entry:set-icon-from-gicon or one of the various other functions that set an icon from an icon name or a paintable. To trigger an action when the user clicks an icon, connect to the entry:icon-press signal. To allow DND operations from an icon, use entry:set-icon-drag-source. To set a tooltip on an icon, use entry:set-icon-tooltip-text 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.

CSS nodes

entry[.flat][.warning][.error]
├── text[.readonly]
├── image.left
├── image.right
╰── [progress[.pulse]]

<GtkEntry> has a main node with the name entry. Depending on the properties of the entry, the style classes .read-only and .flat may appear. The style classes .warning and .error may also be used with entries.

When the entry shows icons, it adds subnodes with the name image and the style class .left or .right, depending on where the icon appears.

When the entry shows progress, it adds a subnode with the name progress. The node has the style class .pulse when the shown progress is pulsing.

For all the subnodes added to the text node in various situations, see <GtkText>.

GtkEntry as GtkBuildable

The <GtkEntry> implementation of the <GtkBuildable> interface supports a custom <attributes> element, which supports any number of <attribute> elements. The <attribute> element has attributes named “name“, “value“, “start“ and “end“ and allows you to specify <PangoAttribute> values for this label.

An example of a UI definition fragment specifying Pango attributes:

<object class="GtkEntry">
  <attributes>
    <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
    <attribute name="background" value="red" start="5" end="10"/>
  </attributes>
</object>

The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.

Accessibility

<GtkEntry> uses the Gtk.AccessibleRole.text_box role.

Properties

Property: entry:activates-default self

Whether to activate the default widget when Enter is pressed.

Its value is a boolean.

Set it with (set! (entry:activates-default self) value).

Property: entry:attributes self

A list of Pango attributes to apply to the text of the entry.

This is mainly useful to change the size or weight of the text.

The <PangoAttribute>’s start-index and end-index must refer to the <GtkEntryBuffer> text, i.e. without the preedit string.

Its value is a <PangoAttrList>, or #f.

Set it with (set! (entry:attributes self) value).

Property: entry:buffer self

The buffer object which actually stores the text.

Its value is a <GtkEntryBuffer>, or #f.

Set it with (set! (entry:buffer self) value).

Property: entry:completion self

The auxiliary completion object to use with the entry.

Its value is a <GtkEntryCompletion>, or #f.

Set it with (set! (entry:completion self) value).

Property: entry:enable-emoji-completion self

Whether to suggest Emoji replacements for :-delimited names like :heart:.

Its value is a boolean.

Set it with (set! (entry:enable-emoji-completion self) value).

Property: entry:extra-menu self

A menu model whose contents will be appended to the context menu.

Its value is a <GMenuModel>, or #f.

Set it with (set! (entry:extra-menu self) value).

Property: entry:has-frame self

Whether the entry should draw a frame.

Its value is a boolean.

Set it with (set! (entry:has-frame self) value).

Property: entry:im-module self

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

See <GtkIMContext>.

Setting this to a non-#f value overrides the system-wide IM module setting. See the GtkSettings settings:gtk-im-module property.

Its value is a string, or #f.

Set it with (set! (entry:im-module self) value).

Property: entry:input-hints self

Additional hints that allow input methods to fine-tune their behavior.

Also see entry:input-purpose

Its value is a <GtkInputHints> (or, to set it, a list of its symbols, or one of them).

Set it with (set! (entry:input-hints self) value).

Property: entry:input-purpose self

The purpose of this text field.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Note that setting the purpose to password or pin is independent from setting entry:visibility.

Its value is a <GtkInputPurpose> (or, to set it, one of its symbols).

Set it with (set! (entry:input-purpose self) value).

Property: entry:invisible-char self

The character to use when masking entry contents (“password mode”).

Its value is an unsigned 32-bit integer.

Set it with (set! (entry:invisible-char self) value).

Property: entry:invisible-char-set self

Whether the invisible char has been set for the <GtkEntry>.

Its value is a boolean.

Set it with (set! (entry:invisible-char-set self) value).

Property: entry:max-length self

Maximum number of characters for this entry.

Its value is a 32-bit integer.

Set it with (set! (entry:max-length self) value).

Property: entry:menu-entry-icon-primary-text self

Text for an item in the context menu to activate the primary icon action.

When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren’t focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

Its value is a string, or #f.

Set it with (set! (entry:menu-entry-icon-primary-text self) value).

Property: entry:menu-entry-icon-secondary-text self

Text for an item in the context menu to activate the secondary icon action.

When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren’t focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

Its value is a string, or #f.

Set it with (set! (entry:menu-entry-icon-secondary-text self) value).

Property: entry:overwrite-mode self

If text is overwritten when typing in the <GtkEntry>.

Its value is a boolean.

Set it with (set! (entry:overwrite-mode self) value).

Property: entry:placeholder-text self

The text that will be displayed in the <GtkEntry> when it is empty and unfocused.

Its value is a string, or #f.

Set it with (set! (entry:placeholder-text self) value).

Property: entry:primary-icon-activatable self

Whether the primary icon is activatable.

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

Sensitive, but non-activatable icons can be used for purely informational purposes.

Its value is a boolean.

Set it with (set! (entry:primary-icon-activatable self) value).

Property: entry:primary-icon-gicon self

The <GIcon> to use for the primary icon for the entry.

Its value is a <GIcon>, or #f.

Set it with (set! (entry:primary-icon-gicon self) value).

Property: entry:primary-icon-name self

The icon name to use for the primary icon for the entry.

Its value is a string, or #f.

Set it with (set! (entry:primary-icon-name self) value).

Property: entry:primary-icon-paintable self

A <GdkPaintable> to use as the primary icon for the entry.

Its value is a <GdkPaintable>, or #f.

Set it with (set! (entry:primary-icon-paintable self) value).

Property: entry:primary-icon-sensitive self

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the entry:icon-press and entry: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.

Its value is a boolean.

Set it with (set! (entry:primary-icon-sensitive self) value).

Property: entry:primary-icon-storage-type self

The representation which is used for the primary icon of the entry.

Its value is a <GtkImageType>.

It is read only.

Property: entry:primary-icon-tooltip-markup self

The contents of the tooltip on the primary icon, with markup.

Also see entry:set-icon-tooltip-markup.

Its value is a string, or #f.

Set it with (set! (entry:primary-icon-tooltip-markup self) value).

Property: entry:primary-icon-tooltip-text self

The contents of the tooltip on the primary icon.

Also see entry:set-icon-tooltip-text.

Its value is a string, or #f.

Set it with (set! (entry:primary-icon-tooltip-text self) value).

Property: entry:progress-fraction self

The current fraction of the task that’s been completed.

Its value is a real number.

Set it with (set! (entry:progress-fraction self) value).

Property: entry:progress-pulse-step self

The fraction of total entry width to move the progress bouncing block for each pulse.

See entry:progress-pulse.

Its value is a real number.

Set it with (set! (entry:progress-pulse-step self) value).

Property: entry:scroll-offset self

Number of pixels of the entry scrolled off the screen to the left.

Its value is a 32-bit integer.

It is read only.

Property: entry:secondary-icon-activatable self

Whether the secondary icon is activatable.

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

Sensitive, but non-activatable icons can be used for purely informational purposes.

Its value is a boolean.

Set it with (set! (entry:secondary-icon-activatable self) value).

Property: entry:secondary-icon-gicon self

The <GIcon> to use for the secondary icon for the entry.

Its value is a <GIcon>, or #f.

Set it with (set! (entry:secondary-icon-gicon self) value).

Property: entry:secondary-icon-name self

The icon name to use for the secondary icon for the entry.

Its value is a string, or #f.

Set it with (set! (entry:secondary-icon-name self) value).

Property: entry:secondary-icon-paintable self

A <GdkPaintable> to use as the secondary icon for the entry.

Its value is a <GdkPaintable>, or #f.

Set it with (set! (entry:secondary-icon-paintable self) value).

Property: entry:secondary-icon-sensitive self

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signal@Gtk.Entry::icon-press[ and entry: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.

Its value is a boolean.

Set it with (set! (entry:secondary-icon-sensitive self) value).

Property: entry:secondary-icon-storage-type self

The representation which is used for the secondary icon of the entry.

Its value is a <GtkImageType>.

It is read only.

Property: entry:secondary-icon-tooltip-markup self

The contents of the tooltip on the secondary icon, with markup.

Also see entry:set-icon-tooltip-markup.

Its value is a string, or #f.

Set it with (set! (entry:secondary-icon-tooltip-markup self) value).

Property: entry:secondary-icon-tooltip-text self

The contents of the tooltip on the secondary icon.

Also see entry:set-icon-tooltip-text.

Its value is a string, or #f.

Set it with (set! (entry:secondary-icon-tooltip-text self) value).

Property: entry:show-emoji-icon self

Whether the entry will show an Emoji icon in the secondary icon position to open the Emoji chooser.

Its value is a boolean.

Set it with (set! (entry:show-emoji-icon self) value).

Property: entry:tabs self

A list of tabstops to apply to the text of the entry.

Its value is a <PangoTabArray>, or #f.

Set it with (set! (entry:tabs self) value).

Property: entry:text-length self

The length of the text in the <GtkEntry>.

Its value is an unsigned 32-bit integer.

It is read only.

Property: entry:truncate-multiline self

When #t, pasted multi-line text is truncated to the first line.

Its value is a boolean.

Set it with (set! (entry:truncate-multiline self) value).

Property: entry:visibility self

Whether the entry should show the “invisible char” instead of the actual text (“password mode”).

Its value is a boolean.

Set it with (set! (entry:visibility self) value).

Procedures

Method: entry:get-activates-default? self ⇒ %return
Method: get-activates-default? self ⇒ %return

Retrieves the value set by entry:set-activates-default.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a boolean.

#t if the entry will activate the default widget

Method: entry:get-alignment self ⇒ %return
Method: get-alignment self ⇒ %return

Gets the value set by entry:set-alignment.

See also: editable:xalign

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a real number.

the alignment

Method: entry:get-attributes self ⇒ %return
Method: get-attributes self ⇒ %return

Gets the attribute list of the <GtkEntry>.

See entry:set-attributes.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <PangoAttrList>, or #f.

the attribute list

Method: entry:get-buffer self ⇒ %return
Method: get-buffer self ⇒ %return

Get the <GtkEntryBuffer> object which holds the text for this widget.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <GtkEntryBuffer>.

A <GtkEntryBuffer> object.

Method: entry:get-completion self ⇒ %return
Method: get-completion self ⇒ %return

Returns the auxiliary completion object currently in use by self.

self

Passed: a <GtkEntry>.

A <GtkEntry>

%return

Returned: a <GtkEntryCompletion>, or #f.

The auxiliary completion object currently in use by self

Method: entry:get-current-icon-drag-source self ⇒ %return
Method: get-current-icon-drag-source self ⇒ %return

Returns the index of the icon which is the source of the current DND operation, or -1.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a 32-bit integer.

index of the icon which is the source of the current DND operation, or -1.

Method: entry:get-extra-menu self ⇒ %return
Method: get-extra-menu self ⇒ %return

Gets the menu model set with entry:set-extra-menu.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <GMenuModel>, or #f.

the menu model

Method: entry:get-has-frame? self ⇒ %return
Method: get-has-frame? self ⇒ %return

Gets the value set by entry:set-has-frame.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a boolean.

whether the entry has a beveled frame

Method: entry:get-icon-activatable? self icon-pos ⇒ %return
Method: get-icon-activatable? self icon-pos ⇒ %return

Returns whether the icon is activatable.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a boolean.

#t if the icon is activatable.

Method: entry:get-icon-area! self icon-pos icon-area ⇒ icon-area
Method: get-icon-area! self icon-pos icon-area ⇒ icon-area

Gets the area where entry’s icon at icon-pos is drawn.

This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized or has no icon at the given position, icon-area is filled with zeros. Otherwise, icon-area will be filled with the icon’s allocation, relative to self’s allocation.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

icon-area

Passed, filled in, and returned: a <GdkRectangle>.

Return location for the icon’s area

Method: entry:get-icon-at-pos self x y ⇒ %return
Method: get-icon-at-pos self x y ⇒ %return

Finds the icon at the given position and return its index.

The position’s coordinates are relative to the self’s top left corner. If x, y doesn’t lie inside an icon, -1 is returned. This function is intended for use in a widget:query-tooltip signal handler.

self

Passed: a <GtkEntry>.

a <GtkEntry>

x

Passed: a 32-bit integer.

the x coordinate of the position to find, relative to self

y

Passed: a 32-bit integer.

the y coordinate of the position to find, relative to self

%return

Returned: a 32-bit integer.

the index of the icon at the given position, or -1

Method: entry:get-icon-gicon self icon-pos ⇒ %return
Method: get-icon-gicon self icon-pos ⇒ %return

Retrieves the <GIcon> used for the icon.

#f will be returned if there is no icon or if the icon was set by some other method (e.g., by <GdkPaintable> or icon name).

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a <GIcon>, or #f.

A <GIcon>

Method: entry:get-icon-name self icon-pos ⇒ %return
Method: get-icon-name self icon-pos ⇒ %return

Retrieves the icon name used for the icon.

#f is returned if there is no icon or if the icon was set by some other method (e.g., by <GdkPaintable> or gicon).

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a string, or #f.

An icon name

Method: entry:get-icon-paintable self icon-pos ⇒ %return
Method: get-icon-paintable self icon-pos ⇒ %return

Retrieves the <GdkPaintable> used for the icon.

If no <GdkPaintable> was used for the icon, #f is returned.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a <GdkPaintable>, or #f.

A <GdkPaintable> if no icon is set for this position or the icon set is not a <GdkPaintable>.

Method: entry:get-icon-sensitive? self icon-pos ⇒ %return
Method: get-icon-sensitive? self icon-pos ⇒ %return

Returns whether the icon appears sensitive or insensitive.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a boolean.

#t if the icon is sensitive.

Method: entry:get-icon-storage-type self icon-pos ⇒ %return
Method: get-icon-storage-type self icon-pos ⇒ %return

Gets the type of representation being used by the icon to store image data.

If the icon has no image data, the return value will be empty.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

%return

Returned: a <GtkImageType>.

image representation being used

Method: entry:get-icon-tooltip-markup self icon-pos ⇒ %return
Method: get-icon-tooltip-markup self icon-pos ⇒ %return

Gets the contents of the tooltip on the icon at the specified position in self.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

the icon position

%return

Returned: a string, or #f.

the tooltip text

Method: entry:get-icon-tooltip-text self icon-pos ⇒ %return
Method: get-icon-tooltip-text self icon-pos ⇒ %return

Gets the contents of the tooltip on the icon at the specified position in self.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

the icon position

%return

Returned: a string, or #f.

the tooltip text

Method: entry:get-input-hints self ⇒ %return
Method: get-input-hints self ⇒ %return

Gets the input hints of this <GtkEntry>.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <GtkInputHints>.

the input hints

Method: entry:get-input-purpose self ⇒ %return
Method: get-input-purpose self ⇒ %return

Gets the input purpose of the <GtkEntry>.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <GtkInputPurpose>.

the input purpose

Method: entry:get-invisible-char self ⇒ %return
Method: get-invisible-char self ⇒ %return

Retrieves the character displayed in place of the actual text in “password mode”.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a character.

the current invisible char, or 0, if the entry does not show invisible text at all.

Method: entry:get-max-length self ⇒ %return
Method: get-max-length self ⇒ %return

Retrieves the maximum allowed length of the text in self.

See entry:set-max-length.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a 32-bit integer.

the maximum allowed number of characters in <GtkEntry>, or 0 if there is no maximum.

Method: entry:get-menu-entry-icon-text self icon-pos ⇒ %return
Method: get-menu-entry-icon-text self icon-pos ⇒ %return

Gets the text that will be used in the context menu of the <GtkEntry> when the specified icon is activatable. Selecting this item in the menu results, from all aspects, the same than clicking on the specified icon. This greatly simplifies making accessible applications, because the icons aren’t focusable when using keyboard navigation. This is why Gtk recommends to add the same action to the context menu.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

either GTK-ENTRY-ICON-PRIMARY or GTK-ENTRY-ICON-SECONDARY

%return

Returned: a string, or #f.

the text that will be used in the menu item, or NULL if no menu item is desired.

Method: entry:get-overwrite-mode? self ⇒ %return
Method: get-overwrite-mode? self ⇒ %return

Gets whether the <GtkEntry> is in overwrite mode.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a boolean.

whether the text is overwritten when typing.

Method: entry:get-placeholder-text self ⇒ %return
Method: get-placeholder-text self ⇒ %return

Retrieves the text that will be displayed when self is empty and unfocused

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a string, or #f.

a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. If no placeholder text has been set, #f will be returned.

Method: entry:get-progress-fraction self ⇒ %return
Method: get-progress-fraction self ⇒ %return

Returns the current fraction of the task that’s been completed.

See entry:set-progress-fraction.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a real number.

a fraction from 0.0 to 1.0

Method: entry:get-progress-pulse-step self ⇒ %return
Method: get-progress-pulse-step self ⇒ %return

Retrieves the pulse step set with entry:set-progress-pulse-step.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a real number.

a fraction from 0.0 to 1.0

Method: entry:get-tabs self ⇒ %return
Method: get-tabs self ⇒ %return

Gets the tabstops of the <GtkEntry>.

See entry:set-tabs.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a <PangoTabArray>, or #f.

the tabstops

Method: entry:get-text-length self ⇒ %return
Method: get-text-length self ⇒ %return

Retrieves the current length of the text in self.

This is equivalent to getting self’s <GtkEntryBuffer> and calling entry-buffer:get-length on it.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: an unsigned 16-bit integer.

the current number of characters in <GtkEntry>, or 0 if there are none.

Method: entry:get-visibility? self ⇒ %return
Method: get-visibility? self ⇒ %return

Retrieves whether the text in self is visible.

See entry:set-visibility.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a boolean.

#t if the text is currently visible

Method: entry:grab-focus-without-selecting? self ⇒ %return
Method: grab-focus-without-selecting? self ⇒ %return

Causes self to have keyboard focus.

It behaves like widget:grab-focus?, except that it doesn’t select the contents of the entry. You only want to call this on some special entries which the user usually doesn’t want to replace all text in, such as search-as-you-type entries.

self

Passed: a <GtkEntry>.

a <GtkEntry>

%return

Returned: a boolean.

#t if focus is now inside self

Procedure: entry:new ⇒ %return

Creates a new entry.

%return

Returned: a <GtkWidget>.

a new <GtkEntry>.

Procedure: entry:new-with-buffer buffer ⇒ %return

Creates a new entry with the specified text buffer.

buffer

Passed: a <GtkEntryBuffer>.

The buffer to use for the new <GtkEntry>.

%return

Returned: a <GtkWidget>.

a new <GtkEntry>

Method: entry:progress-pulse self
Method: progress-pulse self

Indicates that some progress is made, but you don’t know how much.

Causes the entry’s progress indicator to enter “activity mode”, where a block bounces back and forth. Each call to entry:progress-pulse causes the block to move by a little bit (the amount of movement per pulse is determined by entry:set-progress-pulse-step).

self

Passed: a <GtkEntry>.

a <GtkEntry>

Method: entry:reset-im-context self
Method: reset-im-context self

Reset the input method context of the entry if needed.

This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.

self

Passed: a <GtkEntry>.

a <GtkEntry>

Method: entry:set-activates-default self setting
Method: set-activates-default self setting

Sets whether pressing Enter in the self will activate the default widget for the window containing the entry.

This usually means that the dialog containing the entry will be closed, since the default widget is usually one of the dialog buttons.

self

Passed: a <GtkEntry>.

a <GtkEntry>

setting

Passed: a boolean.

#t to activate window’s default widget on Enter keypress

Method: entry:set-alignment self xalign
Method: set-alignment self xalign

Sets the alignment for the contents of the entry.

This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.

See also: editable:xalign

self

Passed: a <GtkEntry>.

a <GtkEntry>

xalign

Passed: a real number.

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts

Method: entry:set-attributes self attrs
Method: set-attributes self attrs

Sets a <PangoAttrList>.

The attributes in the list are applied to the entry text.

Since the attributes will be applied to text that changes as the user types, it makes most sense to use attributes with unlimited extent.

self

Passed: a <GtkEntry>.

a <GtkEntry>

attrs

Passed: a <PangoAttrList>.

a <PangoAttrList>

Method: entry:set-buffer self buffer
Method: set-buffer self buffer

Set the <GtkEntryBuffer> object which holds the text for this widget.

self

Passed: a <GtkEntry>.

a <GtkEntry>

buffer

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

Method: entry:set-completion self [completion]
Method: set-completion self [completion]

Sets completion to be the auxiliary completion object to use with self.

All further configuration of the completion mechanism is done on completion using the GtkEntryCompletion API. Completion is disabled if completion is set to #f.

self

Passed: a <GtkEntry>.

A <GtkEntry>

completion

Passed, or left out: a <GtkEntryCompletion>, or #f.

The GtkEntryCompletion

Method: entry:set-extra-menu self [model]
Method: set-extra-menu self [model]

Sets a menu model to add when constructing the context menu for self.

self

Passed: a <GtkEntry>.

a <GtkEntry>

model

Passed, or left out: a <GMenuModel>, or #f.

a <GMenuModel>

Method: entry:set-has-frame self setting
Method: set-has-frame self setting

Sets whether the entry has a beveled frame around it.

self

Passed: a <GtkEntry>.

a <GtkEntry>

setting

Passed: a boolean.

new value

Method: entry:set-icon-activatable self icon-pos activatable
Method: set-icon-activatable self icon-pos activatable

Sets whether the icon is activatable.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

activatable

Passed: a boolean.

#t if the icon should be activatable

Method: entry:set-icon-drag-source self icon-pos provider actions
Method: set-icon-drag-source self icon-pos provider actions

Sets up the icon at the given position as drag source.

This makes it so that GTK will start a drag operation when the user clicks and drags the icon.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

icon position

provider

Passed: a <GdkContentProvider>.

a <GdkContentProvider>

actions

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

a bitmask of the allowed drag actions

Method: entry:set-icon-from-gicon self icon-pos [icon]
Method: set-icon-from-gicon self icon-pos [icon]

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon isn’t known, a “broken image” icon will be displayed instead.

If icon is #f, no icon will be shown in the specified position.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

The position at which to set the icon

icon

Passed, or left out: a <GIcon>, or #f.

The icon to set

Method: entry:set-icon-from-icon-name self icon-pos [icon-name]
Method: set-icon-from-icon-name self icon-pos [icon-name]

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon name isn’t known, a “broken image” icon will be displayed instead.

If icon-name is #f, no icon will be shown in the specified position.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

The position at which to set the icon

icon-name

Passed, or left out: a string, or #f.

An icon name

Method: entry:set-icon-from-paintable self icon-pos [paintable]
Method: set-icon-from-paintable self icon-pos [paintable]

Sets the icon shown in the specified position using a <GdkPaintable>.

If paintable is #f, no icon will be shown in the specified position.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

paintable

Passed, or left out: a <GdkPaintable>, or #f.

A <GdkPaintable>

Method: entry:set-icon-sensitive self icon-pos sensitive
Method: set-icon-sensitive self icon-pos sensitive

Sets the sensitivity for the specified icon.

self

Passed: a <GtkEntry>.

A <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

Icon position

sensitive

Passed: a boolean.

Specifies whether the icon should appear sensitive or insensitive

Method: entry:set-icon-tooltip-markup self icon-pos [tooltip]
Method: set-icon-tooltip-markup self icon-pos [tooltip]

Sets tooltip as the contents of the tooltip for the icon at the specified position.

tooltip is assumed to be marked up with Pango Markup.

Use #f for tooltip to remove an existing tooltip.

See also widget:set-tooltip-markup and entry:set-icon-tooltip-text.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

the icon position

tooltip

Passed, or left out: a string, or #f.

the contents of the tooltip for the icon

Method: entry:set-icon-tooltip-text self icon-pos [tooltip]
Method: set-icon-tooltip-text self icon-pos [tooltip]

Sets tooltip as the contents of the tooltip for the icon at the specified position.

Use #f for tooltip to remove an existing tooltip.

See also widget:set-tooltip-text and entry:set-icon-tooltip-markup.

If you unset the widget tooltip via widget:set-tooltip-text or widget:set-tooltip-markup, this sets widget:has-tooltip to #f, which suppresses icon tooltips too. You can resolve this by then calling widget:set-has-tooltip to set widget:has-tooltip back to #t, or setting at least one non-empty tooltip on any icon achieves the same result.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

the icon position

tooltip

Passed, or left out: a string, or #f.

the contents of the tooltip for the icon

Method: entry:set-input-hints self hints
Method: set-input-hints self hints

Set additional hints which allow input methods to fine-tune their behavior.

self

Passed: a <GtkEntry>.

a <GtkEntry>

hints

Passed: a <GtkInputHints>, or a list of its symbols, or one of them.

the hints

Method: entry:set-input-purpose self purpose
Method: set-input-purpose self purpose

Sets the input purpose which can be used by input methods to adjust their behavior.

self

Passed: a <GtkEntry>.

a <GtkEntry>

purpose

Passed: a <GtkInputPurpose>, or one of its symbols.

the purpose

Method: entry:set-invisible-char self ch
Method: set-invisible-char self ch

Sets the character to use in place of the actual text in “password mode”.

See entry:set-visibility for how to enable “password mode”.

By default, GTK picks the best invisible char available in the current font. If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

self

Passed: a <GtkEntry>.

a <GtkEntry>

ch

Passed: a character.

a Unicode character

Method: entry:set-max-length self max
Method: set-max-length self max

Sets the maximum allowed length of the contents of the widget.

If the current contents are longer than the given length, then they will be truncated to fit. The length is in characters.

This is equivalent to getting self’s <GtkEntryBuffer> and calling entry-buffer:set-max-length on it.

self

Passed: a <GtkEntry>.

a <GtkEntry>

max

Passed: a 32-bit integer.

the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

Method: entry:set-menu-entry-icon-text self icon-pos text
Method: set-menu-entry-icon-text self icon-pos text

Sets the text that will be used in the context menu of the <GtkEntry> when the specified icon is activatable. Selecting this item in the menu results, from all aspects, the same than clicking on the specified icon. This greatly simplifies making accessible applications, because the icons aren’t focusable when using keyboard navigation. This is why Gtk recommends to add the same action to the context menu.

self

Passed: a <GtkEntry>.

a <GtkEntry>

icon-pos

Passed: a <GtkEntryIconPosition>, or one of its symbols.

either GTK-ENTRY-ICON-PRIMARY or GTK-ENTRY-ICON-SECONDARY

text

Passed: a string.

the text used for the menu item in the context menu, or NULL to not add a menu item.

Method: entry:set-overwrite-mode self overwrite
Method: set-overwrite-mode self overwrite

Sets whether the text is overwritten when typing in the <GtkEntry>.

self

Passed: a <GtkEntry>.

a <GtkEntry>

overwrite

Passed: a boolean.

new value

Method: entry:set-placeholder-text self [text]
Method: set-placeholder-text self [text]

Sets text to be displayed in self when it is empty.

This can be used to give a visual hint of the expected contents of the <GtkEntry>.

self

Passed: a <GtkEntry>.

a <GtkEntry>

text

Passed, or left out: a string, or #f.

a string to be displayed when self is empty and unfocused

Method: entry:set-progress-fraction self fraction
Method: set-progress-fraction self fraction

Causes the entry’s progress indicator to “fill in” the given fraction of the bar.

The fraction should be between 0.0 and 1.0, inclusive.

self

Passed: a <GtkEntry>.

a <GtkEntry>

fraction

Passed: a real number.

fraction of the task that’s been completed

Method: entry:set-progress-pulse-step self fraction
Method: set-progress-pulse-step self fraction

Sets the fraction of total entry width to move the progress bouncing block for each pulse.

Use entry:progress-pulse to pulse the progress.

self

Passed: a <GtkEntry>.

a <GtkEntry>

fraction

Passed: a real number.

fraction between 0.0 and 1.0

Method: entry:set-tabs self [tabs]
Method: set-tabs self [tabs]

Sets a <PangoTabArray>.

The tabstops in the array are applied to the entry text.

self

Passed: a <GtkEntry>.

a <GtkEntry>

tabs

Passed, or left out: a <PangoTabArray>, or #f.

a <PangoTabArray>

Method: entry:set-visibility self visible
Method: set-visibility self visible

Sets whether the contents of the entry are visible or not.

When visibility is set to #f, characters are displayed as the invisible char, and will also appear that way when the text in the entry widget is copied elsewhere.

By default, GTK picks the best invisible character available in the current font, but it can be changed with entry:set-invisible-char.

Note that you probably want to set entry:input-purpose to password or pin to inform input methods about the purpose of this entry, in addition to setting visibility to #f.

self

Passed: a <GtkEntry>.

a <GtkEntry>

visible

Passed: a boolean.

#t if the contents of the entry are displayed as plaintext

Method: entry:unset-invisible-char self
Method: unset-invisible-char self

Unsets the invisible char, so that the default invisible char is used again. See entry:set-invisible-char.

self

Passed: a <GtkEntry>.

a <GtkEntry>

Signals

Signal: entry:activate

Connect a handler with (connect object entry:activate handler). It is called as (handler self).

Emitted when the entry is activated.

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

self

Passed: a <GtkEntry>.

Signal: entry:icon-press

Connect a handler with (connect object entry:icon-press handler). It is called as (handler self icon-pos).

Emitted when an activatable icon is clicked.

self

Passed: a <GtkEntry>.

icon-pos

Passed: a <GtkEntryIconPosition>.

The position of the clicked icon

Signal: entry:icon-release

Connect a handler with (connect object entry:icon-release handler). It is called as (handler self icon-pos).

Emitted on the button release from a mouse click over an activatable icon.

self

Passed: a <GtkEntry>.

icon-pos

Passed: a <GtkEntryIconPosition>.

The position of the clicked icon

Virtual methods

Virtual method: entry:do-activate implementor self

Class handler for the entry:activate signal. The default implementation activates the gtk.activate-default action.

To override it in a new class, give register-type #:vfuncs `((activate . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkEntry>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntry>.