Main Page Widgets Namespaces Book

# Gtk::Entry Class Reference
[Widgets]

Inheritance diagram for Gtk::Entry:

[legend]

List of all members.

## Detailed Description

A single line text entry field.

The Gtk::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.

The Entry widget looks like this:

## Public Member Functions

| Entry ()
gboolean | get_activates_default () const
| Retrieves the value set by set_activates_default().
float | get_alignment () const
| Gets the value set by set_alignment().
Glib::RefPtr< const EntryCompletion > | get_completion () const
| Return value: The auxiliary completion object currently in use by entry.
Glib::RefPtr<EntryCompletion> | get_completion ()
| Return value: The auxiliary completion object currently in use by entry.
const Adjustment* | get_cursor_hadjustment () const
| Retrieves the horizontal cursor adjustment for the entry.
Adjustment* | get_cursor_hadjustment ()
| Retrieves the horizontal cursor adjustment for the entry.
bool | get_has_frame () const
| Gets the value set by set_has_frame().
Border | get_inner_border () const
| This function returns the entry's Gtk::Entry:inner-border property.
gunichar | get_invisible_char () const
| Retrieves the character displayed in place of the real characters for entries with visibility set to false.
Glib::RefPtr<const Pango::Layout> | get_layout () const
| Gets the Pango::Layout used to display the entry.
Glib::RefPtr<Pango::Layout> | get_layout ()
| Gets the Pango::Layout used to display the entry.
void | get_layout_offsets (int& x, int& y)
| Obtains the position of the Pango::Layout used to render text in the entry, in widget coordinates.
int | get_max_length () const
| Retrieves the maximum allowed length of the text in entry.
bool | get_overwrite_mode () const
Glib::ustring | get_text () const
| Retrieves the contents of the entry widget.
guint16 | get_text_length () const
bool | get_visibility () const
| Retrieves whether the text in entry is visible.
int | get_width_chars () const
| Gets the value set by set_width_chars().
const GtkEntry* | gobj () const
| Provides access to the underlying C GtkObject.
GtkEntry* | gobj ()
| Provides access to the underlying C GtkObject.
int | layout_index_to_text_index (int layout_index) const
| Converts from a position in the entry contents (returned by get_text()) to a position in the entry's Pango::Layout (returned by get_layout(), with text retrieved via pango_layout_get_text()).
Glib::PropertyProxy_ReadOnly <bool> | property_activates_default () const
| Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Glib::PropertyProxy<bool> | property_activates_default ()
| Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Glib::PropertyProxy_ReadOnly<int> | property_cursor_position () const
| The current position of the insertion cursor in chars.
Glib::PropertyProxy_ReadOnly <bool> | property_editable () const
| Whether the entry contents can be edited.
Glib::PropertyProxy<bool> | property_editable ()
| Whether the entry contents can be edited.
Glib::PropertyProxy_ReadOnly <bool> | property_has_frame () const
| FALSE removes outside bevel from entry.
Glib::PropertyProxy<bool> | property_has_frame ()
| FALSE removes outside bevel from entry.
Glib::PropertyProxy_ReadOnly <gunichar> | property_invisible_char () const
| The character to use when masking entry contents (in password mode).
Glib::PropertyProxy<gunichar> | property_invisible_char ()
| The character to use when masking entry contents (in password mode).
Glib::PropertyProxy_ReadOnly<int> | property_max_length () const
| Maximum number of characters for this entry.
Glib::PropertyProxy<int> | property_max_length ()
| Maximum number of characters for this entry.
Glib::PropertyProxy_ReadOnly <bool> | property_overwrite_mode () const
| Whether new text overwrites existing text.
Glib::PropertyProxy<bool> | property_overwrite_mode ()
| Whether new text overwrites existing text.
Glib::PropertyProxy_ReadOnly<int> | property_scroll_offset () const
| Number of pixels of the entry scrolled off the screen to the left.
Glib::PropertyProxy_ReadOnly<int> | property_selection_bound () const
| The position of the opposite end of the selection from the cursor in chars.
Glib::PropertyProxy_ReadOnly <ShadowType> | property_shadow_type () const
| Which kind of shadow to draw around the entry when has-frame is set.
Glib::PropertyProxy<ShadowType> | property_shadow_type ()
| Which kind of shadow to draw around the entry when has-frame is set.
Glib::PropertyProxy_ReadOnly <Glib::ustring> | property_text () const
| The contents of the entry.
Glib::PropertyProxy <Glib::ustring> | property_text ()
| The contents of the entry.
Glib::PropertyProxy_ReadOnly <guint> | property_text_length () const
| Length of the text currently in the entry.
Glib::PropertyProxy_ReadOnly <bool> | property_truncate_multiline () const
| Whether to truncate multiline pastes to one line.
Glib::PropertyProxy<bool> | property_truncate_multiline ()
| Whether to truncate multiline pastes to one line.
Glib::PropertyProxy_ReadOnly <bool> | property_visibility () const
| FALSE displays the invisible char instead of the actual text (password mode).
Glib::PropertyProxy<bool> | property_visibility ()
| FALSE displays the invisible char instead of the actual text (password mode).
Glib::PropertyProxy_ReadOnly<int> | property_width_chars () const
| Number of characters to leave space for in the entry.
Glib::PropertyProxy<int> | property_width_chars ()
| Number of characters to leave space for in the entry.
Glib::PropertyProxy_ReadOnly <float> | property_xalign () const
| The horizontal alignment.
Glib::PropertyProxy<float> | property_xalign ()
| The horizontal alignment.
void | set_activates_default (bool setting=true)
| If setting is `true`, pressing Enter in the entry will activate the default widget for the window containing the entry.
void | set_alignment (AlignmentEnum xalign)
| Sets the alignment for the contents of the entry.
void | set_alignment (float xalign)
| Sets the alignment for the contents of the entry.
void | set_completion (const Glib::RefPtr<EntryCompletion>& completion)
| Sets completion to be the auxiliary completion object to use with entry.
void | set_cursor_hadjustment (Adjustment& adjustment)
| Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position.
void | set_has_frame (bool setting=true)
| Sets whether the entry has a beveled frame around it.
void | set_inner_border (const Border& border)
| Sets entry's inner-border property to border, or clears it if `0` is passed.
void | set_invisible_char (gunichar ch)
| Sets the character to use in place of the actual text when set_visibility() has been called to set text visibility to `false`.
void | set_max_length (int max)
| Sets the maximum allowed length of the contents of the widget.
void | set_overwrite_mode (bool overwrite=true)
void | set_text (const Glib::ustring& text)
| Sets the text in the widget to the given value, replacing the current contents.
void | set_visibility (bool visible=true)
| Sets whether the contents of the entry are visible or not.
void | set_width_chars (int n_chars)
| Changes the size request of the entry to be about the right size for n_chars characters.
Glib::SignalProxy0<void> | signal_activate ()
Glib::SignalProxy1< void, const Glib::ustring& > | signal_insert_at_cursor ()
Glib::SignalProxy1<void, Menu*> | signal_populate_popup ()
int | text_index_to_layout_index (int text_index) const
| Converts from a position in the entry's Pango::Layout (returned by get_layout()) to a position in the entry contents (returned by get_text()).
virtual | ~Entry ()

## Protected Member Functions

virtual void | on_activate ()
virtual void | on_insert_at_cursor (const Glib::ustring& str)
virtual void | on_populate_popup (Menu* menu)

## Related Functions

(Note that these are not member functions.)
Gtk::Entry* | wrap (GtkEntry* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

virtual Gtk::Entry::~Entry | ( |  | ) | `[virtual]`

Gtk::Entry::Entry | ( |  | ) |

## Member Function Documentation

gboolean Gtk::Entry::get_activates_default | ( |  | ) | const

Retrieves the value set by set_activates_default().

Returns:
  `true` if the entry will activate the default widget.

float Gtk::Entry::get_alignment | ( |  | ) | const

Gets the value set by set_alignment().

Returns:
  The alignment

Since gtkmm 2.4:

Glib::RefPtr<const EntryCompletion> Gtk::Entry::get_completion | ( |  | ) | const

Return value: The auxiliary completion object currently in use by entry.

Returns:
  The auxiliary completion object currently in use by entry.

Since gtkmm 2.4:

Glib::RefPtr<EntryCompletion> Gtk::Entry::get_completion | ( |  | ) |

Return value: The auxiliary completion object currently in use by entry.

Returns:
  The auxiliary completion object currently in use by entry.

Since gtkmm 2.4:

const Adjustment* Gtk::Entry::get_cursor_hadjustment | ( |  | ) | const

Retrieves the horizontal cursor adjustment for the entry.

See set_cursor_hadjustment().

Returns:
  The horizontal cursor adjustment, or `0` if none has been set.

Since gtkmm 2.12:

Adjustment* Gtk::Entry::get_cursor_hadjustment | ( |  | ) |

Retrieves the horizontal cursor adjustment for the entry.

See set_cursor_hadjustment().

Returns:
  The horizontal cursor adjustment, or `0` if none has been set.

Since gtkmm 2.12:

bool Gtk::Entry::get_has_frame | ( |  | ) | const

Gets the value set by set_has_frame().

Returns:
  Whether the entry has a beveled frame.

Border Gtk::Entry::get_inner_border | ( |  | ) | const

This function returns the entry's Gtk::Entry:inner-border property.

See set_inner_border() for more information.

Returns:
  The entry's Gtk::Border, or `0` if none was set.

Since gtkmm 2.10:

gunichar Gtk::Entry::get_invisible_char | ( |  | ) | const

Retrieves the character displayed in place of the real characters for entries with visibility set to false.

See set_invisible_char().

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

Glib::RefPtr<const Pango::Layout> Gtk::Entry::get_layout | ( |  | ) | const

Gets the Pango::Layout used to display the entry.

The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets(). The returned layout is owned by the entry and must not be modified or freed by the caller.

Keep in mind that the layout text may contain a preedit string, so layout_index_to_text_index() and text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

Returns:
  The Pango::Layout for this entry.

Glib::RefPtr<Pango::Layout> Gtk::Entry::get_layout | ( |  | ) |

Gets the Pango::Layout used to display the entry.

The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets(). The returned layout is owned by the entry and must not be modified or freed by the caller.

Keep in mind that the layout text may contain a preedit string, so layout_index_to_text_index() and text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

Returns:
  The Pango::Layout for this entry.

void Gtk::Entry::get_layout_offsets | ( | int & | x,
|  | int & | y |
| ) |  |  |

Obtains the position of the Pango::Layout used to render text in the entry, in widget coordinates.

Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

Also useful to convert mouse events into coordinates inside the Pango::Layout, 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 Pango::Layout 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 layout_index_to_text_index() and text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

Parameters:

  | x | Location to store X offset of layout, or `0`.
  | y | Location to store Y offset of layout, or `0`.

int Gtk::Entry::get_max_length | ( |  | ) | const

Retrieves the maximum allowed length of the text in entry.

See set_max_length().

Returns:
  The maximum allowed number of characters in Gtk::Entry, or 0 if there is no maximum.

bool Gtk::Entry::get_overwrite_mode | ( |  | ) | const

Glib::ustring Gtk::Entry::get_text | ( |  | ) | const

Retrieves the contents of the entry widget.

See also Gtk::Editable::get_chars().

Returns:
  The contents of the entry widget.

guint16 Gtk::Entry::get_text_length | ( |  | ) | const

bool Gtk::Entry::get_visibility | ( |  | ) | const

Retrieves whether the text in entry is visible.

See set_visibility().

Returns:
  `true` if the text is currently visible.

int Gtk::Entry::get_width_chars | ( |  | ) | const

Gets the value set by set_width_chars().

Returns:
  Number of chars to request space for, or negative if unset.

const GtkEntry* Gtk::Entry::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::CellEditable.

Reimplemented in Gtk::SpinButton.

GtkEntry* Gtk::Entry::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::CellEditable.

Reimplemented in Gtk::SpinButton.

int Gtk::Entry::layout_index_to_text_index | ( | int | layout_index | ) | const

Converts from a position in the entry contents (returned by get_text()) to a position in the entry's Pango::Layout (returned by get_layout(), with text retrieved via pango_layout_get_text()).

Parameters:

  | layout_index | Byte index into the entry layout text.

Returns:
  Byte index into the entry contents.

virtual void Gtk::Entry::on_activate | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Entry::on_insert_at_cursor | ( | const Glib::ustring & | str | ) | `[protected, virtual]`

virtual void Gtk::Entry::on_populate_popup | ( | Menu* | menu | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_activates_default | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_activates_default | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Entry::property_cursor_position | ( |  | ) | const

The current position of the insertion cursor in chars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_editable | ( |  | ) | const

Whether the entry contents can be edited.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_editable | ( |  | ) |

Whether the entry contents can be edited.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_has_frame | ( |  | ) | const

FALSE removes outside bevel from entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_has_frame | ( |  | ) |

FALSE removes outside bevel from entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<gunichar> Gtk::Entry::property_invisible_char | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<gunichar> Gtk::Entry::property_invisible_char | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Entry::property_max_length | ( |  | ) | const

Maximum number of characters for this entry.

Zero if no maximum.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::Entry::property_max_length | ( |  | ) |

Maximum number of characters for this entry.

Zero if no maximum.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_overwrite_mode | ( |  | ) | const

Whether new text overwrites existing text.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_overwrite_mode | ( |  | ) |

Whether new text overwrites existing text.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Entry::property_scroll_offset | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Entry::property_selection_bound | ( |  | ) | const

The position of the opposite end of the selection from the cursor in chars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<ShadowType> Gtk::Entry::property_shadow_type | ( |  | ) | const

Which kind of shadow to draw around the entry when has-frame is set.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<ShadowType> Gtk::Entry::property_shadow_type | ( |  | ) |

Which kind of shadow to draw around the entry when has-frame is set.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::Entry::property_text | ( |  | ) | const

The contents of the entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::Entry::property_text | ( |  | ) |

The contents of the entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Entry::property_text_length | ( |  | ) | const

Length of the text currently in the entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_truncate_multiline | ( |  | ) | const

Whether to truncate multiline pastes to one line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_truncate_multiline | ( |  | ) |

Whether to truncate multiline pastes to one line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Entry::property_visibility | ( |  | ) | const

FALSE displays the invisible char instead of the actual text (password mode).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Entry::property_visibility | ( |  | ) |

FALSE displays the invisible char instead of the actual text (password mode).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Entry::property_width_chars | ( |  | ) | const

Number of characters to leave space for in the entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::Entry::property_width_chars | ( |  | ) |

Number of characters to leave space for in the entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<float> Gtk::Entry::property_xalign | ( |  | ) | const

The horizontal alignment.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<float> Gtk::Entry::property_xalign | ( |  | ) |

The horizontal alignment.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Entry::set_activates_default | ( | bool | setting = `true` | ) |

If setting is `true`, pressing Enter in the entry will activate the default widget for the window containing the entry.

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

(For experts: if setting is `true`, the entry calls Gtk::Window::activate_default() on the window containing the entry, in the default handler for the Gtk::Widget::activate signal.)

Parameters:

  | setting | `true` to activate window's default widget on Enter keypress.

void Gtk::Entry::set_alignment | ( | AlignmentEnum | 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.

Since gtkmm 2.4:

Parameters:

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

void Gtk::Entry::set_alignment | ( | float | 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.

Since gtkmm 2.4:

Parameters:

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

void Gtk::Entry::set_completion | ( | const Glib::RefPtr<EntryCompletion>& | completion | ) |

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

All further configuration of the completion mechanism is done on completion using the Gtk::EntryCompletion API. Completion is disabled if completion is set to `0`.

Since gtkmm 2.4:

Parameters:

  | completion | The Gtk::EntryCompletion or `0`.

void Gtk::Entry::set_cursor_hadjustment | ( | Adjustment& | adjustment | ) |

Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position.

See Gtk::ScrolledWindow::get_hadjustment() for a typical way of obtaining the adjustment.

The adjustment has to be in pixel units and in the same coordinate system as the entry.

Since gtkmm 2.12:

Parameters:

  | adjustment | An adjustment which should be adjusted when the cursor is moved, or `0`.

void Gtk::Entry::set_has_frame | ( | bool | setting = `true` | ) |

Sets whether the entry has a beveled frame around it.

Parameters:

  | setting | New value.

void Gtk::Entry::set_inner_border | ( | const Border& | border | ) |

Sets entry's inner-border property to border, or clears it if `0` is passed.

The inner-border is the area around the entry's text, but inside its frame.

If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.

Since gtkmm 2.10:

Parameters:

  | border | A Gtk::Border, or `0`.

void Gtk::Entry::set_invisible_char | ( | gunichar | ch | ) |

Sets the character to use in place of the actual text when set_visibility() has been called to set text visibility to `false`.

i.e. this is the character used in "password mode" to show the user how many characters have been typed. The default invisible char is an asterisk ('*'). 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.

Parameters:

  | ch | A Unicode character.

void Gtk::Entry::set_max_length | ( | int | 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.

Parameters:

  | max | 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.

void Gtk::Entry::set_overwrite_mode | ( | bool | overwrite = `true` | ) |

void Gtk::Entry::set_text | ( | const Glib::ustring & | text | ) |

Sets the text in the widget to the given value, replacing the current contents.

Parameters:

  | text | The new text.

void Gtk::Entry::set_visibility | ( | bool | visible = `true` | ) |

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

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

The default invisible char is the asterisk '*', but it can be changed with set_invisible_char().

Parameters:

  | visible | `true` if the contents of the entry are displayed as plaintext.

void Gtk::Entry::set_width_chars | ( | int | n_chars | ) |

Changes the size request of the entry to be about the right size for n_chars characters.

Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

Parameters:

  | n_chars | Width in chars.

Glib::SignalProxy0< void > Gtk::Entry::signal_activate | ( |  | ) |

Prototype:
  `void on_my_activate()`

Glib::SignalProxy1< void,const Glib::ustring& > Gtk::Entry::signal_insert_at_cursor | ( |  | ) |

Prototype:
  `void on_my_insert_at_cursor(const Glib::ustring& str)`

Glib::SignalProxy1<void,Menu*> Gtk::Entry::signal_populate_popup | ( |  | ) |

Prototype:
  `void on_my_populate_popup(Menu* menu)`

int Gtk::Entry::text_index_to_layout_index | ( | int | text_index | ) | const

Converts from a position in the entry's Pango::Layout (returned by get_layout()) to a position in the entry contents (returned by get_text()).

Parameters:

  | text_index | Byte index into the entry contents.

Returns:
  Byte index into the entry layout text.

## Friends And Related Function Documentation

Gtk::Entry* wrap | ( | GtkEntry * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- entry.h