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.
fireEntryEvent
protected void fireEntryEvent(EntryEvent event)
getAlignment
public float getAlignment()
getEventListenerClass
public Class getEventListenerClass(String signal)
- getEventListenerClass in interface Widget
getEventType
public EventType getEventType(String signal)
- getEventType in interface Widget
getHasFrame
public boolean getHasFrame()
getLayout
public Layout getLayout()
Gets the Layout used to display the entry. This layout is
useful to convert text positions to pixel positions in combination
with getLayoutOffsets.
- The PangoLayout for this entry
getLayoutOffsets
public Point getLayoutOffsets()
Obtains the position of the Layout used to render text in the entry,
in widget coordinates. Useful if you want to line up the text in
the entry with some other text, e.g. when using the entry to implement
editable cells in a sheet widget.
- A
Point
identifying the x and y offset
of the layout.
getMaxLength
public int getMaxLength()
Returns the maximum length of the contents of the widget.
getText
public String getText()
Retrieve the contents of the entry widget.
- the text of the widget
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
- getType in interface Widget
getVisible
public boolean getVisible()
Retrieves whether the contents of the entry are visible or not.
getWidth
public int getWidth()
- Number of chars to request space for, or negative if unset.
gtk_entry_get_activates_default
protected static final boolean gtk_entry_get_activates_default(Handle entry)
gtk_entry_get_completion
protected static final Handle gtk_entry_get_completion(Handle entry)
gtk_entry_get_has_frame
protected static final boolean gtk_entry_get_has_frame(Handle entry)
gtk_entry_get_invisible_char
protected static final byte gtk_entry_get_invisible_char(Handle entry)
gtk_entry_get_layout
protected static final Handle gtk_entry_get_layout(Handle entry)
gtk_entry_get_layout_offsets
protected static final void gtk_entry_get_layout_offsets(Handle entry,
int[] x,
int[] y)
gtk_entry_get_max_length
protected static final int gtk_entry_get_max_length(Handle entry)
gtk_entry_get_text
protected static final String gtk_entry_get_text(Handle entry)
gtk_entry_get_type
protected static final int gtk_entry_get_type()
gtk_entry_get_visibility
protected static final boolean gtk_entry_get_visibility(Handle entry)
gtk_entry_get_width_chars
protected static final int gtk_entry_get_width_chars(Handle entry)
gtk_entry_new
protected static final Handle gtk_entry_new()
gtk_entry_set_activates_default
protected static final void gtk_entry_set_activates_default(Handle entry,
boolean setting)
gtk_entry_set_completion
protected static final void gtk_entry_set_completion(Handle entry,
Handle completion)
gtk_entry_set_has_frame
protected static final void gtk_entry_set_has_frame(Handle entry,
boolean setting)
gtk_entry_set_invisible_char
protected static final void gtk_entry_set_invisible_char(Handle entry,
byte ch)
gtk_entry_set_max_length
protected static final void gtk_entry_set_max_length(Handle entry,
int max)
gtk_entry_set_text
protected static final void gtk_entry_set_text(Handle entry,
String text)
gtk_entry_set_visibility
protected static final void gtk_entry_set_visibility(Handle entry,
boolean visible)
gtk_entry_set_width_chars
protected static final void gtk_entry_set_width_chars(Handle entry,
int numChars)
handleToggleOverwrite
public void handleToggleOverwrite()
layoutIndexToTextIndex
public int layoutIndexToTextIndex(int layoutIndex)
selectRegion
public void selectRegion(int start,
int end)
Methods from Editable
- selectRegion in interface Editable
setActivateDefaultWidget
public void setActivateDefaultWidget(boolean setting)
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.
setting
- TRUE to activate window's default widget on Enter
keypress
setAlignment
public void setAlignment(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.
xalign
- The horizontal alignment, from 0 (left) to 1
(right). Reversed for RTL layouts.
setHasFrame
public void setHasFrame(boolean setting)
Sets whether the entry has a beveled frame around it.
setInvisibleChar
public void setInvisibleChar(char character)
Sets the character to use in place of the actual text when
setVisibility has been called to set text visibility to
FALSE (ie 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.
setMaxLength
public void setMaxLength(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.
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.
setText
public void setText(String text)
Sets the text in the widget to the given value, replacing the current
contents.
text
- The new text.
setVisible
public void setVisible(boolean visible)
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 setInvisibleChar().
setWidth
public void setWidth(int number)
Changes the size request of the entry to be about the right size
for number 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.
number
- Width in Characters
textIndexToLayoutIndex
public int textIndexToLayoutIndex(int textIndex)