Superclass: widget atk-implementor-iface buildable cell-editable editable
Subclasses: spin-button
The entry 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 entry-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-invisible-char. 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 entry-caps-lock-warning property.
Since 2.16, entry has the ability to display progress or activity information behind the text. To make an entry display such information, use entry-progress-fraction or entry-progress-pulse-step,
Additionally, entry 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-primary-icon-gicon or one of the various other properties 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 entry::icon-press signal. To allow DND operations from an icon, use gtk_entry_set_icon_drag_source(). To set a tooltip on an icon, use entry-primary-icon-tooltip-text or entry-primary-icon-tooltip-markup. Secondary icon works the same way.
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.
Slots:
boolean
. Accessor: entry-activates-default
.
Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Default value: False
boolean
. Accessor: entry-caps-lock-warning
.
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
entry-completion
.
The current position of the insertion cursor in chars.
Allowed values: [0,65535]
Default value: 0
entry-cursor-hadjustment
.
The adjustment that is bound to the cursor position.
The adjustment has to be in pixel units and in the same coordinate system as the entry.
integer
. Accessor: entry-cursor-position
. Read-only.
Whether the entry contents can be edited.
Default value: True
boolean
. Accessor: entry-editable
.
False removes outside bevel from entry.
Default value: True
boolean
. Accessor: entry-has-frame
.
False removes outside bevel from entry.
Default value: True
string
. Accessor: entry-im-module
.
Which IM (input method) module should be used for this entry. See i-m-context.
Setting this to a non-NIL value overrides the system-wide IM module setting. See the settings-gtk-im-module property.
Default value: NIL
entry-inner-border
.
Sets the text area's border between the text and the frame.
Since 2.10
integer
. Accessor: entry-invisible-char
.
The character to use when masking entry contents (in "password mode").
Default value: '*'
boolean
. Accessor: entry-invisible-char-set
.
Whether the invisible char has been set for the GtkEntry.
Default value: False
PangoLayout
. Accessor: entry-layout
. Read-only.
The PangoLayout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with entry-layout-offset.
Keep in mind that the layout text may contain a preedit string, so entry-layout-index-to-text-index and entry-text-index-to-layout-index are needed to convert byte indices in the layout to byte indices in the entry contents.
integer
. Accessor: entry-layout-offset
. Read-only.
Obtains the position of the PangoLayout used to render text in the entry, in widget coordinates as the list of two integers - the x and y offsets. 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.
Note that as the user scrolls around in the entry the offsets will change; you'll need to connect to the "notify::scroll-offset" signal to track this. Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.
Keep in mind that the layout text may contain a preedit string, so entry-layout-index-to-text-index and entry-text-index-to-layout-index are needed to convert byte indices in the layout to byte indices in the entry contents.
integer
. Accessor: entry-max-length
.
Maximum number of characters for this entry. Zero if no maximum.
Allowed values: [0,65535]
Default value: 0
boolean
. Accessor: entry-overwrite-mode
.
If text is overwritten when typing in the GtkEntry.
Default value: False
boolean
. Accessor: entry-primary-icon-activatable
.
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.
Default value: False
GIcon
. Accessor: entry-primary-icon-gicon
.
The GIcon to use for the primary icon for the entry. TODO: GIcon is not yet supported
string
. Accessor: entry-primary-icon-name
.
The icon name to use for the primary icon for the entry.
Default value: NIL
entry-primary-icon-pixbuf
.
A pixbuf to use as the primary icon for the entry.
boolean
. Accessor: entry-primary-icon-sensitive
.
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.
Default value: True
string
. Accessor: entry-primary-icon-stock
.
The stock id to use for the primary icon for the entry.
Default value: NIL
entry-primary-icon-storage-type
. Read-only.
The representation which is used for the primary icon of the entry.
Default value: :empty
string
. Accessor: entry-primary-icon-tooltip-markup
.
The contents of the tooltip on the primary icon, which is marked up with the Pango text markup language.
Default value: NIL
string
. Accessor: entry-primary-icon-tooltip-text
.
The contents of the tooltip on the primary icon.
Default value: NIL
double-float
. Accessor: entry-progress-fraction
.
The current fraction of the task that's been completed.
Allowed values: [0,1]
Default value: 0
double-float
. Accessor: entry-progress-pulse-step
.
The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse().
Allowed values: [0,1]
Default value: 0.1
integer
. Accessor: entry-scroll-offset
. Read-only.
Number of pixels of the entry scrolled off the screen to the left.
Allowed values: >= 0
Default value: 0
boolean
. Accessor: entry-secondary-icon-activatable
.
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.
Default value: False
GIcon
. Accessor: entry-secondary-icon-gicon
.
The GIcon to use for the secondary icon for the entry. TODO: GIcon is not yet supported
string
. Accessor: entry-secondary-icon-name
.
The icon name to use for the secondary icon for the entry.
Default value: NIL
entry-secondary-icon-pixbuf
.
An pixbuf to use as the secondary icon for the entry.
boolean
. Accessor: entry-secondary-icon-sensitive
.
Whether the secondary 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.
Default value: True
string
. Accessor: entry-secondary-icon-stock
.
The stock id to use for the secondary icon for the entry.
Default value: NIL
entry-secondary-icon-storage-type
. Read-only.
The representation which is used for the secondary icon of the entry.
Default value: :empty
string
. Accessor: entry-secondary-icon-tooltip-markup
.
The contents of the tooltip on the secondary icon, which is marked up with the Pango text markup language.
Default value: NIL
string
. Accessor: entry-secondary-icon-tooltip-text
.
The contents of the tooltip on the secondary icon.
Default value: NIL
integer
. Accessor: entry-selection-bound
. Read-only.
The position of the opposite end of the selection from the cursor in chars.
Allowed values: [0,65535]
Default value: 0
entry-shadow-type
.
Which kind of shadow to draw around the entry when "has-frame" is set to True.
Default value: :in
string
. Accessor: entry-text
.
The contents of the entry.
Default value: ""
integer
. Accessor: entry-text-length
. Read-only.
The length of the text in the GtkEntry.
Allowed values: <= 65535
Default value: 0
boolean
. Accessor: entry-truncate-multiline
.
When True, pasted multi-line text is truncated to the first line.
Default value: False
boolean
. Accessor: entry-visibility
.
False displays the "invisible char" instead of the actual text (password mode).
Default value: True
integer
. Accessor: entry-width-chars
.
Number of characters to leave space for in the entry.
Default value: -1
single-float
. Accessor: entry-xalign
.
The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.
Allowed values: [0,1]
Default value: 0
Signals:
A keybinding signal which gets emitted when the user activates the entry.
Applications should not connect to it, but may emit it with emit-signal if they need to control activation programmatically.
The default bindings for this signal are all forms of the Enter key.
This 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.
This 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.
This 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.
integer
) => void. Options: run-last, action.
This signal is a keybinding signal which gets emitted when the user initiates a text deletion.
If the type is :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.
count is the number of type units to delete
This signal is emitted when an activatable icon is clicked.
entry-icon-position
), (event event) => void. Options: run-last.
This signal is emitted on the button release from a mouse click over an activatable icon.
string
) => void. Options: run-last, action.
This 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.
integer
), (extend-selection boolean
) => void. Options: run-last, action.
This 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 emit-signal 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.
count is the number of step units to move
extend-selection is True if the move should extend the selection
This 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.
This 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.
This 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-layout-index-to-text-index entry layout-index) => text-index
Converts from a position in the entry contents to a position in the entry's PangoLayout.
layout-index - byte index into the entry layout text
text-index - byte index into the entry contents
(entry-text-index-to-layout-index entry text-index) => layout-index
Converts from a position in the entry's PangoLayout contents to a position in the entry.
layout-index - byte index into the entry layout text
text-index - byte index into the entry contents