An entry is a convenience widget which shows a box that the user can enter text into.
Entries by default don’t scroll, so they grow to accommodate the entire text, resizing the parent window as needed. This can be changed with the property scrollable.
They can also be single line or multi line (the default) and when set to multi line mode they support text wrapping in any of the modes indicated by Wrap mode.
Other features include password mode, filtering of inserted text with markup_filter_append() and related functions, inline “items” and formatted markup text.
This widget supports the scrollable interface.
If you wish to control the scolling behaviour using these functions, inherit both the widget class and the Scrollable class using multiple inheritance, for example:
class ScrollableGenlist(Genlist, Scrollable):
def __init__(self, canvas, *args, **kwargs):
Genlist.__init__(self, canvas)
The markup tags supported by the Entry are defined by the theme, but even when writing new themes or extensions it’s a good idea to stick to a sane default, to maintain coherency and avoid application breakages. Currently defined by the default theme are the following tags:
Besides those used to format text, entries support two special markup tags used to insert click-able portions of text or items inlined within the text.
Anchors are similar to HTML anchors. Text can be surrounded by <a> and </a> tags and an event will be generated when this text is clicked, like this:
This text is outside <a href=anc-01>but this one is an anchor</a>
The href attribute in the opening tag gives the name that will be used to identify the anchor and it can be any valid utf8 string.
When an anchor is clicked, an "anchor,clicked" signal is emitted with an EntryAnchorInfo in the event_info parameter for the callback function. The same applies for anchor,in (mouse in), anchor,out (mouse out), anchor,down (mouse down), and anchor,up (mouse up) events on an anchor.
Inlined in the text, any other Object can be inserted by using <item> tags this way:
<item size=16x16 vsize=full href=emoticon/haha></item>
Just like with anchors, the href identifies each item, but these need, in addition, to indicate their size, which is done using any one of size, absize or relsize attributes. These attributes take their value in the WxH format, where W is the width and H the height of the item.
Besides their size, items are specified a vsize value that affects how their final size and position are calculated. The possible values are:
After the size for an item is calculated, the entry will request an object to place in its space. For this, the functions set with item_provider_append() and related functions will be called in order until one of them returns a non-None value. If no providers are available, or all of them return None, then the entry falls back to one of the internal defaults, provided the name matches with one of them.
All of the following are currently supported:
Alternatively, an item may reference an image by its path, using the URI form file:///path/to/an/image.png and the entry will then use that image for the item.
There are 2 major ways to change the entry’s style:
You should modify the theme when you would like to change the style for aesthetic reasons. While the user style should be changed when you would like to change the style to something specific defined at run-time, e.g, setting font or font size in a text editor.
Entries have convenience functions to load text from a file and save changes back to it after a short delay. The automatic saving is enabled by default, but can be disabled with autosave and files can be loaded directly as plain text or have any markup in them recognized. See file for more details.
No auto-capitalization when typing
Autocapitalize each word typed
Autocapitalize the start of each sentence
Autocapitalize all letters
Copy & paste text with markup tags
Copy & paste text without item (image) tags
Copy & paste text without markup tags
No active hints
New in version 1.12.
Suggest word auto completion
New in version 1.12.
typed text should not be stored
New in version 1.12.
Automatic
Alphabetic
Default layout
Number layout
Email layout
URL layout
Phone number layout
IP layout
Month layout
Number only layout
Never use this
Hexadecimal layout
Command-line terminal layout
Like normal, but no auto-correct, no auto-capitalization etc.
Date and time layout
New in version 1.10.
Emoticon layout
New in version 1.10.
The plain normal layout
New in version 1.12.
Filename layout. Symbols such as ‘/’ should be disabled
New in version 1.12.
The name of a person
New in version 1.12.
The numberonly normal layout
New in version 1.12.
The signed number layout
New in version 1.12.
The decimal number layout
New in version 1.12.
The signed and decimal number layout
New in version 1.12.
The normal password layout
New in version 1.12.
The password layout to allow only number
New in version 1.12.
Default
Done
Go
Join
Login
Next
Search
Send
Sign-in
New in version 1.10.
Bases: efl.elementary.__init__.LayoutClass
This is the class that actually implements the widget.
By default, entries are:
Changed in version 1.8: Inherits from LayoutClass.
Parameters: |
|
---|
Ends the hover popup in the entry
When an anchor is clicked, the entry widget will create a hover object to use as a popup with user provided content. This function terminates this popup, returning the entry to its normal state.
Parent of the hover popup
The parent object to use by the hover created by the entry when an anchor is clicked. See Hover for more details on this.
Type: | Object |
---|
The style that the hover should use
When creating the popup hover, entry will request that it’s themed according to style.
Setting style to None means disabling automatic hover.
Seealso: | style |
---|---|
Type: | string |
Autocapitalization type on the immodule.
Type: | Autocapitalization types |
---|
New in version 1.8.
Whether the entry object ‘autosaves’ the loaded text file or not.
Type: | bool |
---|
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Forces calculation of the entry size and text layouting.
This should be used after modifying the textblock object directly.
Seealso: | textblock |
---|
The enter key was pressed on a single line entry.
The enter key was pressed on a single line entry.
An anchor has been clicked. The event_info parameter for the callback will be an EntryAnchorInfo.
Mouse button has been pressed on an anchor. The event_info parameter for the callback will be an EntryAnchorInfo.
Mouse cursor has moved into an anchor. The event_info parameter for the callback will be an EntryAnchorInfo.
Mouse cursor has moved out of an anchor. The event_info parameter for the callback will be an EntryAnchorInfo.
Mouse button has been unpressed on an anchor. The event_info parameter for the callback will be an EntryAnchorInfo.
The text within the entry was changed.
The text within the entry was changed because of user interaction.
The entry has been clicked (mouse press and release).
Called before showing the context menu.
New in version 1.15.
The cursor has changed position.
The entry has been double clicked.
The entry has received focus.
Program language changed.
A mouse button has been pressed and held for a couple seconds.
The preedit string has changed.
A mouse button has been pressed on the entry.
Called when some of inputs are rejected by the filter.
New in version 1.9.
The current selection has changed.
The current selection has been cleared.
A copy of the selected text into the clipboard was requested.
A cut of the selected text into the clipboard was requested.
A paste of the clipboard contents was requested.
A selection has begun and no previous selection existed.
Whole text has been set to the entry.
The entry has been triple clicked.
The entry has lost focus.
Control pasting of text and images for the widget.
Normally the entry allows both text and images to be pasted. By setting cnp_mode to be ELM_CNP_MODE_NO_IMAGE, this prevents images from being copy or past. By setting cnp_mode to be ELM_CNP_MODE_PLAINTEXT, this remove all tags in text .
Note
This only changes the behaviour of text.
Type: | Copy & paste modes |
---|
Retrieve data from a widget that has a selection.
Gets the current selection data from a widget.
See also
efl.elementary.object.Object.cnp_selection_get()
Parameters: |
|
---|---|
Return bool: | Whether getting cnp data is successful or not. |
This clears and frees the items in a entry’s contextual (longpress) menu.
See also
This disables the entry’s contextual (longpress) menu.
Type: | bool |
---|
This adds an item to the entry’s contextual menu.
A longpress on an entry will make the contextual menu show up, if this hasn’t been disabled with context_menu_disabled. By default, this menu provides a few options like enabling selection mode, which is useful on embedded devices that need to be explicit about it, and when a selection exists it also shows the copy and cut actions.
With this function, developers can add other options to this menu to perform any action they deem necessary.
Parameters: |
|
---|
New in version 1.8.
This moves the cursor to the beginning of the entry.
Gets the character pointed by the cursor at its current position.
This function returns a string with the utf8 character stored at the current cursor position. Only the text is returned, any format that may exist will not be part of the return value.
Returns: | The text pointed by the cursors. |
---|---|
Return type: | unicode |
This moves the cursor one line down within the entry.
Returns: | True upon success, False upon failure |
---|---|
Return type: | bool |
This moves the cursor to the end of the entry.
This function returns the geometry of the cursor.
It’s useful if you want to draw something on the cursor (or where it is), or for example in the case of scrolled entry where you want to show the cursor.
Returns: | Geometry (x, y, w, h) |
---|---|
Return type: | tuple of Evas_Coords (int) or None |
Changed in version 1.8: Returns None when the cursor geometry cannot be fetched.
Gets whether a format node exists at the current cursor position.
A format node is anything that defines how the text is rendered. It can be a visible format node, such as a line break or a paragraph separator, or an invisible one, such as bold begin or end tag. This function returns whether any format node exists at the current cursor position.
Seealso: | cursor_is_visible_format_get() |
---|---|
Returns: | True if the current cursor position contains a format node, False otherwise. |
Return type: | bool |
Gets if the current cursor position holds a visible format node.
Seealso: | cursor_is_format_get() |
---|---|
Returns: | True if the current cursor is a visible format, False if it’s an invisible one or no format exists. |
Return type: | bool |
This moves the cursor to the beginning of the current line.
This moves the cursor to the end of the current line.
This moves the cursor one place to the right within the entry.
Returns: | True upon success, False upon failure |
---|---|
Return type: | bool |
The cursor position in the entry
The value is the index of the character position within the contents of the string.
Type: | int |
---|
This moves the cursor one place to the left within the entry.
Returns: | True upon success, False upon failure |
---|---|
Return type: | bool |
This begins a selection within the entry as though the user were holding down the mouse button to make a selection.
This ends a selection within the entry as though the user had just released the mouse button while making a selection.
This moves the cursor one line up within the entry.
Returns: | True upon success, False upon failure |
---|---|
Return type: | bool |
If the entry is to be editable or not.
By default, entries are editable and when focused, any text input by the user will be inserted at the current cursor position. Setting this as False will prevent the user from inputting text into the entry.
The only way to change the text of a non-editable entry is to use text, entry_insert() and other related functions and properties.
Type: | bool |
---|
Sets the visibility of the end widget of the entry, set by Entry.part_content_set("end", content).
Type: | bool |
---|
New in version 1.8.
The text displayed within the entry to entry.
Note
Setting this bypasses text filters
Type: | string |
---|
Appends entry to the text of the entry.
Adds the text in entry to the end of any text already present in the widget.
The appended text is subject to any filters set for the widget.
Seealso: | markup_filter_append() |
---|---|
Parameters: | entry (string) – The text to be displayed |
Inserts the given text into the entry at the current cursor position.
This inserts text at the cursor position as if it was typed by the user (note that this also allows markup which a user can’t just “type” as it would be converted to escaped text, so this call can be used to insert things like emoticon items or bold push/pop tags, other font and color change tags etc.)
If any selection exists, it will be replaced by the inserted text.
The inserted text is subject to any filters set for the widget.
Seealso: | markup_filter_append() |
---|---|
Parameters: | entry (string) – The text to insert |
The file for the text to display and then edit.
All changes are written back to the file after a short delay if the entry object is set to autosave (which is the default).
If the entry had any other file set previously, any changes made to it will be saved if the autosave feature is enabled, otherwise, the file will be silently discarded and any non-saved changes will be lost.
Type: | (unicode file_name, Text format file_format) |
---|---|
Raises RuntimeError: | |
when setting the file fails |
Changed in version 1.8: Raise RuntimeError when setting the file fails, instead of returning a bool.
Sets the visibility of the end widget of the entry, set by Entry.part_content_set("icon", content).
Type: | bool |
---|
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. This will typically cause the Input Method Context to clear the preedit state.
The input hint which allows input methods to fine-tune their behavior.
Type: | Input Hints |
---|
New in version 1.12.
Whether to show the input panel automatically or not.
Type: | bool |
---|
Hide the input panel (virtual keyboard).
Note that input panel is shown or hidden automatically according to the focus state of entry widget. This API can be used in the case of manually controlling by using Entry.input_panel_enabled_set = False.
The language mode of the input panel.
This API can be used if you want to show the alphabet keyboard mode.
Type: | Input panel language sort order |
---|
The input panel layout of the entry
Type: | Input panel layouts |
---|
Input panel layout variation of the entry
Type: | int |
---|
New in version 1.8.
Set whether the return key on the input panel is disabled automatically when entry has no text.
If enabled is True, The return key on input panel is disabled when the entry has no text. The return key on the input panel is automatically enabled when the entry has text. The default value is False.
Type: | bool |
---|
Whether the return key on the input panel is disabled or not.
Type: | bool |
---|
The “return” key type. This type is used to set string or icon on the “return” key of the input panel.
An input panel displays the string or icon associated with this type
Type: | Input panel return key modes |
---|
Show the input panel (virtual keyboard) based on the input panel property of entry such as layout, autocapital types, and so on.
Note that input panel is shown or hidden automatically according to the focus state of entry widget. This API can be used in the case of manually controlling by using Entry.input_panel_enabled = False.
Input panel show on demand.
Set the attribute to show the input panel in case of only an user’s explicit Mouse Up event.
Type: | bool |
---|
New in version 1.9.
Gets whether the entry is empty.
Empty means no text at all. If there are any markup tags, like an item tag for which no provider finds anything, and no text is displayed, this function still returns False.
Type: | bool |
---|
The line wrap type to use on multi-line entries.
This tells how the text will be implicitly cut into a new line (without inserting a line break or paragraph separator) when it reaches the far edge of the widget.
Note that this only makes sense for multi-line entries. A widget set to be single line will never wrap.
Type: | Wrap mode |
---|
Append a markup filter function for text inserted in the entry
Append the given callback to the list. This functions will be called whenever any text is inserted into the entry, with the text to be inserted as a parameter. The type of given text is always markup. The callback function is free to alter the text in any way it wants. If the new text is to be discarded, the function can return None. This will also prevent any following filters from being called.
Parameters: |
|
---|
New in version 1.8.
Prepend a markup filter function for text inserted in the entry
Prepend the given callback to the list. See markup_filter_append() for more information
Parameters: |
|
---|
New in version 1.8.
Remove a markup filter from the list
Removes the given callback from the filter list. See markup_filter_append() for more information
Parameters: |
|
---|
New in version 1.8.
Deprecated since version 1.8: Use the module level markup_to_utf8() method instead.
Sets the entry to password mode.
In password mode, entries are implicitly single line and the display of any text in them is replaced with asterisks (*).
Type: | bool |
---|
Whether the entry should allow to use the text prediction.
Type: | bool |
---|
Enable or disable scrolling in entry
Normally the entry is not scrollable.
Type: | bool |
---|
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
This selects all text within the entry.
This drops any existing text selection within the entry.
This selects a region of text within the entry.
Parameters: |
|
---|
Gets any selected text within the entry.
If there’s any selected text in the entry, this function returns it as a string in markup format. None is returned if no selection exists or if an error occurred.
Type: | string |
---|
This executes a “copy” action on the selected text in the entry.
This executes a “cut” action on the selected text in the entry.
This executes a “paste” action in the entry.
Single line mode.
In single line mode, entries don’t ever wrap when the text reaches the edge, and instead they keep growing horizontally. Pressing the Enter key will generate an "activate" event instead of adding a new line.
When single_line is False, line wrapping takes effect again and pressing enter will break the text into a different line without generating any events.
Type: | bool |
---|
Retrieve the style on the top of user style stack.
Return string: | style on the top of user style stack if exist, otherwise None. |
---|---|
Seealso: | text_style_user_push() |
New in version 1.8.
Remove the style in the top of user style stack.
Seealso: | text_style_user_push() |
---|
New in version 1.8.
Push the style to the top of user style stack.
If there is styles in the user style stack, the properties in the top style of user style stack will replace the properties in current theme. The input style is specified in format:
tag='property=value'
i.e.:
DEFAULT='font=Sans font_size=60' hilight=' + font_weight=Bold'
Parameters: | style (string) – The style user to push |
---|
New in version 1.8.
Returns the actual textblock object of the entry.
This function exposes the internal textblock object that actually contains and draws the text. This should be used for low-level manipulations that are otherwise not possible.
Changing the textblock directly from here will not notify edje/elm to recalculate the textblock size automatically, so any modifications done to the textblock returned by this function should be followed by a call to calc_force().
The return value is marked as const as an additional warning. One should not use the returned object with any of the generic evas functions (geometry_get/resize/move and etc), but only with the textblock functions; The former will either not work at all, or break the correct functionality.
Warning
Many functions may change (i.e delete and create a new one) the internal textblock object. Do NOT cache the returned object, and try not to mix calls on this object with regular elm_entry calls (which may change the internal textblock object). This applies to all cursors returned from textblock calls, and all the other derivative values.
Type: | Textblock |
---|
Deprecated since version 1.8: Use the module level utf8_to_markup() method instead.
Bases: object
Type of contextual item that can be added in to long press menu.
New in version 1.8.
Get the icon object of the contextual menu item.
Type: | (unicode icon_file, unicode icon_group, Icon type icon_type) |
---|
New in version 1.8.
Get the text of the contextual menu item.
Type: | unicode |
---|
New in version 1.8.
Bases: object
entry filter.
The maximum number of bytes allowed.
Type: | int |
---|
The maximum number of characters allowed.
Type: | int |
---|
Bases: object
entry filter.
Set of characters accepted in the entry.
Type: | string |
---|
Set of characters rejected from the entry.
Type: | string |
---|
Bases: object
The info sent in the callback for the anchor,clicked signals emitted by entries.
The name of the anchor, as stated in its href.
Type: | string |
---|
The mouse button used to click on it.
Type: | Button |
---|
Anchor geometry, relative to canvas.
Type: | int |
---|
Anchor geometry, relative to canvas.
Type: | int |
---|
Anchor geometry, relative to canvas.
Type: | int |
---|
Anchor geometry, relative to canvas.
Type: | int |
---|
Bases: object
The info sent in the callback for anchor,hover,opened signals emitted by the entries.
The actual anchor info.
Type: | EntryAnchorInfo |
---|
The hover object to use for the popup.
Type: | Hover |
---|
Hint indicating if there’s space for content on the left side of the hover.
Type: | bool |
---|
Hint indicating content fits on the right side of the hover.
Type: | bool |
---|
Hint indicating content fits on top of the hover.
Type: | bool |
---|
Hint indicating content fits below the hover.
Type: | bool |
---|